Skip to content

Commit b87414d

Browse files
committed
fix json api headers
1 parent 550b4fc commit b87414d

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

app/Http/Controllers/Api/V1/SiteController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ public function register(SiteRequest $request): JsonResponse
4848
$site = new Site();
4949

5050
$site->key = $key;
51-
$site->url = $url;
51+
$site->url = rtrim($url, "/");
5252
$site->last_seen = Carbon::now();
5353

5454
// Fill with site info

app/RemoteSite/Connection.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ public function performExtractionRequest(array $requestData): array
7575
protected function performWebserviceRequest(
7676
HttpMethod $method,
7777
string $endpoint,
78-
array $requestData = []
78+
?array $requestData = null
7979
): array {
8080
$request = new Request(
8181
$method->name,
@@ -89,7 +89,11 @@ protected function performWebserviceRequest(
8989
$response = $this->performHttpRequest(
9090
$request,
9191
[
92-
"json" => $requestData
92+
"json" => $requestData,
93+
"headers" => [
94+
"Content-Type" => "application/json",
95+
"Accept" => "application/vnd.api+json"
96+
]
9397
]
9498
);
9599

0 commit comments

Comments
 (0)