Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

content-length #13

Closed
HeSe opened this issue Dec 21, 2013 · 3 comments · Fixed by #14
Closed

content-length #13

HeSe opened this issue Dec 21, 2013 · 3 comments · Fixed by #14

Comments

@HeSe
Copy link

HeSe commented Dec 21, 2013

Hi!
I try to put data with the help of AddBodyString to my request and the server isn't able to process it since the content-length is missing...

Am I supposed to use "AddParameter" with: "Content-Length" after having done "AddBodyString " or am I missing something different?

Thanks for the help!
Sebastian

@timhall
Copy link
Member

timhall commented Dec 22, 2013

@HeSe Excel-REST isn't set up to automatically add the content-length parameter, but I'll add the functionality soon. In the meantime, use AddHeader to add the Content-Length to the request. Example:

Dim Body As String
Body = "..."

Request.AddBodyString Body
Request.AddHeader "Content-Length", Len(Body)

@HeSe
Copy link
Author

HeSe commented Dec 22, 2013

Hi Tim,

thanks for the reply. I had tried this, but it didn't work either.

I realized that I had fogotten to set the httpGET to the intended httpPOST method. Now it works,... but I stil lwonder now, if it should still possible to put a body into a httpGET call... it is not the way it should be in REST, but it still should be possible...

Sebastian

@timhall
Copy link
Member

timhall commented Dec 23, 2013

Excel-REST will add the Body to all requests (including GET) if it is set explicitly using Request.AddBody or Request.AddBodyString.

The only case where the Body is not added is for Request.AddParameter for GET requests since those are added as query string parameters. (This behavior was based on my experience with RestSharp)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants