Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
554 views
in Technique[技术] by (71.8m points)

api - Postman GET options works but fails with cURL command line

I am running a spring application and when doing GET requests on POSTMAN I get my API response, see below enter image description here

However, when I run a curl command I get a 307 Redirect error

enter image description here

I tried to dig into but could not solve it. Could be a proxy issue ?

question from:https://stackoverflow.com/questions/65861444/postman-get-options-works-but-fails-with-curl-command-line

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

As pointed out by @pavelsaman, you're using different endpoints in Postman and your curl.

To avoid that and run the very same request in curl as in Postman, you can export your request from Postman as curl:

Click "Code", then select "cURL", copy the code, and paste it to your commandline: enter image description here

You can find the documentation here: https://learning.postman.com/docs/sending-requests/generate-code-snippets/


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...