Skip to content

Commit

Permalink
fix webservice request headers
Browse files Browse the repository at this point in the history
  • Loading branch information
SniperSister committed Nov 17, 2024
1 parent 23dc2e7 commit b4bb224
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
4 changes: 2 additions & 2 deletions app/Http/Controllers/Api/V1/SiteController.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public function register(SiteRequest $request): JsonResponse
$url = $request->string('url');
$key = $request->string('key');

$connectionService = App::makeWith(Connection::class, [$url, $key]);
$connectionService = App::makeWith(Connection::class, ["baseUrl" => $url, "key" => $key]);

// Do a health check
try {
Expand All @@ -49,7 +49,7 @@ public function register(SiteRequest $request): JsonResponse
$site = new Site();

$site->key = $key;
$site->url = $url;
$site->url = rtrim($url, "/");
$site->last_seen = Carbon::now();

// Fill with site info
Expand Down
12 changes: 7 additions & 5 deletions app/RemoteSite/Connection.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,15 +67,13 @@ public function performExtractionRequest(array $requestData): array
]
);

$responseData = $this->decodeResponse($response, $request);

return $responseData;
return $this->decodeResponse($response, $request);
}

protected function performWebserviceRequest(
HttpMethod $method,
string $endpoint,
array $requestData = []
?array $requestData = null
): array {
$request = new Request(
$method->name,
Expand All @@ -89,7 +87,11 @@ protected function performWebserviceRequest(
$response = $this->performHttpRequest(
$request,
[
"json" => $requestData
"json" => $requestData,
"headers" => [
"Content-Type" => "application/json",
"Accept" => "application/vnd.api+json"
]
]
);

Expand Down

0 comments on commit b4bb224

Please sign in to comment.