Re: [go-nuts] Re: Get request send me hmtl content but works fine from python and curl

2020-09-20 Thread Brian Candler
On Sunday, 20 September 2020 12:18:09 UTC+1, ryan embgrets wrote: > > Thanks everyone for your valuable feedback. > I was able to figure out the issue that was happening due to the > case-sensitive nature of the loginId header, which was being normalized in > golang. > > So, after adding the be

Re: [go-nuts] Re: Get request send me hmtl content but works fine from python and curl

2020-09-20 Thread Tamás Gulácsi
Which is absolutely non-standard :) Headers are case-insensitive, so if the server relies on case, it's against the HTTP standard :) remb...@gmail.com a következőt írta (2020. szeptember 20., vasárnap, 13:18:09 UTC+2): > Thanks everyone for your valuable feedback. > I was able to figure out th

Re: [go-nuts] Re: Get request send me hmtl content but works fine from python and curl

2020-09-20 Thread ryan embgrets
Thanks everyone for your valuable feedback. I was able to figure out the issue that was happening due to the case-sensitive nature of the loginId header, which was being normalized in golang. So, after adding the below snippet i was able to make it work. req.Header["loginId"] = []string{"0610A62F

Re: [go-nuts] Re: Get request send me hmtl content but works fine from python and curl

2020-09-20 Thread Jesper Louis Andersen
On Sun, Sep 20, 2020 at 8:10 AM burak serdar wrote: > A GET request does not have a body. > > Murky waters ahead. RFC 2616 explicitly states that a supplied body SHOULD be forwarded by the server on any request type. This has led some people to use bodies on GET requests; ElasticSearch I'm looki

Re: [go-nuts] Re: Get request send me hmtl content but works fine from python and curl

2020-09-20 Thread Brian Candler
My suggestion is to change the URL to something you control, with http not https, and see how the requests differ using tcpdump. Here's what I get: python3 import requests r=requests.get("http://localhost/foo";, params = {'version':'5', "phoneList":"XX", "output":"json"}, header

Re: [go-nuts] Re: Get request send me hmtl content but works fine from python and curl

2020-09-20 Thread Tamás Gulácsi
Log the Python request, to see what it really sends - or recreate it with curl, which is easier to debug (--trace). remb...@gmail.com a következőt írta (2020. szeptember 20., vasárnap, 8:19:57 UTC+2): > Thanks for taking time to answer my question. I have put the actual data > except the login

Re: [go-nuts] Re: Get request send me hmtl content but works fine from python and curl

2020-09-19 Thread ryan embgrets
Thanks for taking time to answer my question. I have put the actual data except the loginId header.. https://play.golang.org/p/KrnxWLVj8s2 But i still get the html content in golang but when i use python i get the invalid api credentials. Due to incorrect loginId header. import requests r = req

Re: [go-nuts] Re: Get request send me hmtl content but works fine from python and curl

2020-09-19 Thread burak serdar
On Sat, Sep 19, 2020 at 11:47 PM Tamás Gulácsi wrote: > > I bet requests (and curl) encodes the params as multipart/form-data, NOT > query string. > Do the same: https://play.golang.org/p/L4YryKNjju4 A GET request does not have a body. I suggest you print out the request struct completely befor

[go-nuts] Re: Get request send me hmtl content but works fine from python and curl

2020-09-19 Thread Tamás Gulácsi
I bet requests (and curl) encodes the params as multipart/form-data, NOT query string. Do the same: https://play.golang.org/p/L4YryKNjju4 remb...@gmail.com a következőt írta (2020. szeptember 19., szombat, 20:44:54 UTC+2): > I am trying to call a simple api by using golang. But, each time it se