Is it possible to customize HTTP request headers with WebRequest? - page 2

 
mikeitexpert:

I have trying to set the user-agent in the request header, but apparently I don't get any relevant response from server .....

Is it possible to set user agent in request's header? What is the default user agent? 

Please let me know.

Hi, were you able to fix this problem?

I'm getting the same response in nodejs

{ '{"key": "value"}': '' }
 
mrwick #:

Hi, were you able to fix this problem?

I'm getting the same response in nodejs

Did anyone fix this problem?
I also send "Content-Type: application / json" but always respond to "Content-Type: application / x-www-form-urlencoded".

My API is resful and always uses json.

Pic. 1 is request Header.

Pic. 2: I use wireshark to caprure.

Files:
1.JPG  24 kb
2.JPG  109 kb
 
lelelethu #:
Did anyone fix this problem?
I also send "Content-Type: application / json" but always respond to "Content-Type: application / x-www-form-urlencoded".

My API is resful and always uses json.

Pic. 1 is request Header.

Pic. 2: I use wireshark to caprure.

Thanks everyone. I found this problem. 

Please see my image in this post. There are 2 type Webrequest. Type 1 always call with " application/x-www-form-urlencoded". Type 2 is flexible.

Use type 2 for json.

Files:
3.JPG  82 kb
Reason: