2

I am trying to call a authentication URL using apache HttpPost, passing all the request parameters like userid, pwd hardcoded for proof of concept purpose. I found it is not working with a response code of 302. However if I submit the same request from chrome PostMan or Advanced RestClient it is found to be working with 200 response code. I am able to get the correct response of the Post call.

Want to understand If I am doing anything wrong or my understanding about RestClient (POSTMAN/Advanced RestClient) is wrong.

Please suggest

Thanks,

user2585494
  • 483
  • 2
  • 7
  • 18

1 Answers1

0

A HTTP 302 response is a request to redirect.

When Postman receives this response, it will automagically redirect to the URL provided in the HTTP 302 response - you'll see this if you install Postman Interceptor.

Apache HTTPClient doesn't do this automatic redirection - so you see the raw HTTP 302 redirect. Use the location in the HTTP 302 response to perform the redirect.

Community
  • 1
  • 1
Tadhg
  • 561
  • 5
  • 15
  • Now, in a similar scenario, I'm getting a HTTP 503 HTTPClient, but Postman is getting a HTTP 200 response. Any suggestions? :) – Tadhg Mar 04 '16 at 00:02