Browse Source

Adjust PHP language example to allow the display of explicit set Content-Type header.

Richard Dubiel 3 years ago
parent
commit
41cf1d97f8
1 changed files with 2 additions and 6 deletions
  1. 2 6
      resources/views/partials/example-requests/php.md.blade.php

+ 2 - 6
resources/views/partials/example-requests/php.md.blade.php

@@ -8,12 +8,8 @@ $client = new \GuzzleHttp\Client();
 $response = $client->{{ strtolower($endpoint->httpMethods[0]) }}(
     '{{ rtrim($baseUrl, '/') . '/' . ltrim($endpoint->boundUri, '/') }}',
     [
-@if(!empty($endpoint->headers))@php
-// We don't need the Content-Type header because Guzzle sets it automatically when you use json or multipart.
-$headers = $endpoint->headers;
-unset($headers['Content-Type']);
-@endphp
-        'headers' => {!! u::printPhpValue($headers, 8) !!},
+@if(!empty($endpoint->headers))
+        'headers' => {!! u::printPhpValue($endpoint->headers, 8) !!},
 @endif
 @if(!empty($endpoint->cleanQueryParameters))
         'query' => {!! u::printQueryParamsAsKeyValue($endpoint->cleanQueryParameters, "'", "=>", 12, "[]", 8) !!},