Page Menu
Home
DevCentral
Search
Configure Global Search
Log In
Files
F3715942
D2691.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Referenced Files
None
Subscribers
None
D2691.diff
View Options
diff --git a/src/BaseService.php b/src/BaseService.php
--- a/src/BaseService.php
+++ b/src/BaseService.php
@@ -27,9 +27,19 @@
echo $responseBody;
}
+ protected function sendBadRequestResponse () {
+ header("HTTP/1.0 400 Bad Request");
+ http_response_code(400);
+ }
+
protected function sendInvalidMethodResponse () {
header("HTTP/1.0 405 Method Not Allowed");
http_response_code(405);
}
+ protected function sendInternalServerErrorResponse () {
+ header("HTTP/1.0 500 Internal Server Error");
+ http_response_code(500);
+ }
+
}
diff --git a/src/Service.php b/src/Service.php
--- a/src/Service.php
+++ b/src/Service.php
@@ -37,8 +37,19 @@
}
public function put ($data) : void {
+ if ($data === NULL) {
+ $this->sendBadRequestResponse();
+ return;
+ }
+
+ $log = self::getServersLogFile();
+ if (!$log) {
+ $this->sendInternalServerError();
+ return;
+ }
+
Log::addEntryToJSONFile(
- self::getServersLogFile(),
+ $log,
LogEntry::fromJSON($data)
);
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Wed, Nov 6, 11:30 (21 h, 53 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2231698
Default Alt Text
D2691.diff (1 KB)
Attached To
Mode
D2691: Guard PUT requests against null exceptions
Attached
Detach File
Event Timeline
Log In to Comment