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 to overwrite with different Content-Type #238

Closed
michielbdejong opened this issue Feb 17, 2021 · 8 comments
Closed

PUT to overwrite with different Content-Type #238

michielbdejong opened this issue Feb 17, 2021 · 8 comments

Comments

@michielbdejong
Copy link
Contributor

What should happen when you do:

  curl -v https://server/some/path -X PUT -H 'Content-Type: text/turtle' -d '<#first> <#some> <#turtle> .'
  curl -v https://server/some/path -X PUT -H 'Content-Type: text/plain' -d 'now replace with plain text'

NSS, PSS and CSS all execute the second request updating the resource, but ESS gives a 400 Bad Request response and leaves the resource unchanged.

@joachimvh
Copy link

npm start
curl -v http://localhost:3000/data -X PUT -H "Content-Type: text/turtle" -d "<#first> <#some> <#turtle> ."
curl -v http://localhost:3000/data -X PUT -H "Content-Type: text/plain" -d "now replace with plain text"

For me the last request returns 205, so in case this keeps not working for you this might be better suited for an issue in the CSS repo explaining how to reproduce.

@michielbdejong
Copy link
Contributor Author

@joachimvh Yes, I agree it's working as expected in CSS. It's ESS that returns a 400.

@joachimvh
Copy link

@joachimvh Yes, I agree it's working as expected in _C_SS. It's _E_SS that returns a 400.

Ah my mistake, I misread. 😅

Would also be interested in knowing then what behaviour is expected.

@csarven
Copy link
Member

csarven commented Feb 17, 2021

NSS, PSS and CSS all execute the second request updating the resource, but ESS gives a 400 Bad Request response and leaves the resource unchanged.

Seems fine to me based on the information you've provided.

I think 200, 202, 205 (possibly others) can be acceptable.

I don't see a particular issue with 400, but can see 415, 405 or maybe even 409 working here. One reason for the 400 may be due to server recognising text/plain along the lines of LDP's NonRDFSource, and text/turtle as LDP's RDFSource. And, client's second request may be an attempt to change the interaction model and so server wants to ensure that the original interaction model that is set on the resource is honoured. On a related note, it is also possible that server considers the second request as conflicting with AWWW's recommendation on making sure of consistent representations for a given URI (hence the "persistence").

/me pokes @acoburn

Having constraints and problem details may be able to make the response more useful ( #185 )

@acoburn
Copy link
Member

acoburn commented Feb 17, 2021

That sequence of requests is attempting to change the LDP interaction model and is therefore rejected. A link header in the response will tell you as much.

IOW, this is expected behavior

@acoburn
Copy link
Member

acoburn commented Feb 17, 2021

See the discussion at #121

@michielbdejong
Copy link
Contributor Author

OK, thanks for clarifying!

@michielbdejong
Copy link
Contributor Author

So basically clients should not attempt this because a pod server cannot be expected to execute such requests.

@edwardsph let's remove the test for this.

michielbdejong added a commit to solid-contrib/solid-crud-tests that referenced this issue Feb 17, 2021
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

4 participants