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

PUT and content-length #7

Open
Pietro395 opened this issue Jun 1, 2022 · 9 comments
Open

PUT and content-length #7

Pietro395 opened this issue Jun 1, 2022 · 9 comments

Comments

@Pietro395
Copy link

We are using this module to develop a driver for a BOSE soundbar.

We have successfully implemented the GET and POST methods.
Testing with postman the same parameters used in the POST, in the PUT it works correctly.

While with the PUT method on Crestron we get the error '411 - Length Required'.

We tried to manually insert the Content-Length in the header but without success.

Is the Content-Length in the PUT implemented and sent in the request?

immagine

@bitm0de
Copy link
Owner

bitm0de commented Jun 1, 2022

It's definitely a bug in the Crestron SDK because the content source is being set to string for every other method except GET. DELETE probably could've been added to that exclusion list, although if there's a defined content string then the underlying libraries should be setting the header.

@bitm0de bitm0de changed the title PUT and content-lenght PUT and content-length Jun 1, 2022
@Pietro395
Copy link
Author

It's definitely a bug in the Crestron SDK because the content source is being set to string for every other method except GET. DELETE probably could've been added to that exclusion list, although if there's a defined content string then the underlying libraries should be setting the header.

Thanks, is there a way to report this bug to Crestron?

@bitm0de
Copy link
Owner

bitm0de commented Jun 2, 2022

It's definitely a bug in the Crestron SDK because the content source is being set to string for every other method except GET. DELETE probably could've been added to that exclusion list, although if there's a defined content string then the underlying libraries should be setting the header.

Thanks, is there a way to report this bug to Crestron?

You'd have to go through TrueBlue support, although I suspect this would still take some time to be acknowledged and fixed. There may be some properties that can be set to force it to send the Content-Length header, although by default it's not working as it should. When the content source and content is set, it should be sending that length in the applicable Content-Length header, always.

@bitm0de
Copy link
Owner

bitm0de commented Jun 2, 2022

Are you trying to send an empty string for the content of your PUT request?

@Pietro395
Copy link
Author

No, my content string was set, i think i'm missing content-source.

We currently do not have access to the Simpl #, so I believe that for now it is infeasible for us to report the bug

@Pietro395
Copy link
Author

I have contacted TrueBlue support, let you know if I have updates

@Pietro395
Copy link
Author

A quick follow up, I created a project and sent to support to recreate the problem.
I confirm that the content-length is missing in the PUT requests. You can see this in the response from the endpoint

POST:
immagine

PUT:
immagine

@bitm0de
Copy link
Owner

bitm0de commented Jun 16, 2022

A quick follow up, I created a project and sent to support to recreate the problem. I confirm that the content-length is missing in the PUT requests. You can see this in the response from the endpoint

POST: immagine

PUT: immagine

I understand that it's missing, the point I was attempting to make above is that you don't have to do this for a POST request because this is intended to be controlled by the Crestron class itself when the content is set. This is also how Microsoft's .NET 4.5+ HttpClient class works, but it doesn't miss including the Content-Length header (it does as it should).

@Pietro395
Copy link
Author

In the example above, in fact, I did not manually add the content length, I would like it to be inserted automatically by the Crestron class also in the PUT :)
Are you referring to this?

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

No branches or pull requests

2 participants