6

I have a pretty simple Postman request that works just fine in Postman. It's just a GET request to the following URL:

http://www.toysrus.com/storefrontsearch/stores.jsp?skuId=24654884&quantity=1&postalCode=48103&latitude&longitude&productId=107531766&startIndexForPagination=0&searchRadius=0&pageType=product&ispu_or_sts=null&displayAllStoresFlag=false&displayAllStoreLink=false

If I ask Postman to make a cURL request out of that for me, it gives me this:

curl -X GET \ 'http://www.toysrus.com/storefrontsearch/stores.jsp?skuId=24654884&quantity=1&postalCode=48103&latitude=&longitude=&productId=107531766&startIndexForPagination=0&searchRadius=0&pageType=product&ispu_or_sts=null&displayAllStoresFlag=false&displayAllStoreLink=false' \ -H 'cache-control: no-cache' \ -H 'postman-token: b4ae79c0-c3f0-8247-8c2f-306c43376039'

The result is that it just hangs forever and never gives me a response.

Any idea what can be done to get the cURL request working?

Jason Swett
  • 41,074
  • 64
  • 208
  • 335

2 Answers2

8

It seems the server has banned curl user-agent, also the cookies troute=t1 needs to be set otherwise it returns 404 :

curl -L -H 'User-Agent: Mozilla' \
        -H 'Cookie: troute=t1;' \
        'http://www.toysrus.com/storefrontsearch/stores.jsp?skuId=24654884&quantity=1&postalCode=48103&latitude&longitude&productId=107531766&startIndexForPagination=0&searchRadius=0&pageType=product&ispu_or_sts=null&displayAllStoresFlag=false&displayAllStoreLink=false' --compressed
Bertrand Martel
  • 38,018
  • 15
  • 115
  • 140
3

Beware of the cookie monster

Not all Postman requests are made equal.

Postman will store cookies whether you like it or not (and send them over in subsequent calls to the same domain).

I didn't realize my first call to the same domain was receiving a cookie that was sent back on the next call from Postman. So even though everything looked the same, I wasn't sending the cookie through curl.

bubbassauro
  • 3,421
  • 2
  • 45
  • 44