I have a web service that requires authorization and content type included in the header of every post request. using the .addHeaders("Authorization", TOKEN);
.addHeaders("content-type", "application/json");
it returns unauthorized access but accessing the same service using postman returns the expected response.
Try addHeader("Authorization", "Bearer " + TOKEN)
its still not working
Try setting content type like this setContentType("application/json; charset=utf-8")
its still not working
Same error here
Finally worked on my side; had unwanted chars, so did .addHeaders("Authorization", basicAuth.trim())
its working. thanks
Most helpful comment
its working. thanks