Skip to content
Advertisement

curl getting redirect instead of response

I’ve tested my REST API via Postman and tests and got a response, but when I use curl I’m getting

JavaScript

screen from postman enter image description here

the code:

app.py

JavaScript

route.py

JavaScript

controller.py

JavaScript

Advertisement

Answer

By default curl doesn’t follow redirection, you have to use -L argument.

In curl’s tradition of only doing the basics unless you tell it differently, it does not follow HTTP redirects by default. Use the -L, –location to tell it to do that.

Source: https://everything.curl.dev/http/redirects#tell-curl-to-follow-redirects

User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement