Reputation: 2417
I have an API. In this API, I pass X-AUTH_TOKEN
& X-AUTH-KEY
as headers and in the body, I pass raw array data ["1", "2", "3"....]
I have tested it using postman, it is returning me response.
But when I implement it using symfony, I am getting HTTP/2 404 returned for "
This is what I have implemented in Symfony.
$response = $this->httpClient->request('POST', $url, [
'headers' => [
'x-auth-token' => $authToken,
'x-auth-key' => $authKey
],
'body' => [
"1",
"2",
"3",
"4",
]
]);
Can anybody please help me how can I implement?
Thank You.
Upvotes: 1
Views: 406
Reputation: 2417
Instead of body
pass json
$response = $this->httpClient->request('POST', $url, [
'headers' => [
'x-auth-token' => $authToken,
'x-auth-key' => $authKey
],
'body' => [
"1",
"2",
"3",
"4",
]
]);
Upvotes: 2