Repository navigation
|
I am migrating from request module to got module and i am facing this issue. { When i use this options with got module. I get a response saying HTTPError: Response code 422 (Unprocessable Entity). The API is behind an oauth gateway but on the VPN it works with request module. But it does work with GOT module. The strange thing is i get 422 from the oauth gateway while using GOT but if i use request i get the expected response from the actual API. Any suggestion/help is much appreciated. |
Replies: 6 comments
|
If you copied and pasted this exact snippet from your code, this line doesn't make any sense: Can you provide an example to test it. |
This is the exact option which are passed to got. I picked it up from the logs. { If i use the request module for the same options, i get the expected response. In case of GOT i get 422. |
|
Without some code to reproduce the issue I can't help you. |
|
On my end this is working fine: const got = require('got');
(async () => {
const response = await got('https://postman-echo.com/post', {
timeout: 5000,
time: true,
headers: { 'Content-Type': 'application/json' },
body: '["12114704","12114883"]',
method: 'POST',
}).json();
console.log(response);
})(); |
Yes it works in this case. I checked that the API service is behind a gitlab auth and so this issue comes. Because first i get a Redirect and then i get this response which i shared above. |
|
We have decided to change the auth mechanism for the API service. @Giotino Thanks. |
On my end this is working fine: