Request an XHTML representation, get redirected to a JSON representation
Bug #704214 reported by
Leonard Richardson
This bug affects 1 person
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
lazr.restful |
Fix Released
|
High
|
Leonard Richardson |
Bug Description
If you make a request from a web browser that results in an HTTP redirect, the ws.accept header is supposed to be set to the value of your request's "Accept" header. Actually, it's set to the value of the *response*'s "Accept" header. Since "Accept" isn't a response header, the default (application/json) is used. This means that you can ask for an XHTML representation on your initial request and end up asking for a JSON representation when you follow the redirect.
Related branches
lp:~leonardr/lazr.restful/fix-ws-accept-on-redirect
- Edwin Grubbs (community): Approve (code)
-
Diff: 56 lines (+16/-3)4 files modifiedsrc/lazr/restful/NEWS.txt (+6/-0)
src/lazr/restful/example/base/tests/redirect.txt (+8/-0)
src/lazr/restful/publisher.py (+1/-2)
src/lazr/restful/version.txt (+1/-1)
Changed in lazr.restful: | |
status: | New → In Progress |
Changed in lazr.restful: | |
status: | In Progress → Fix Released |
importance: | Undecided → High |
assignee: | nobody → Leonard Richardson (leonardr) |
To post a comment you must log in.
This manifests in Launchpad when you change the target of a bug using the AJAX form. The browser makes the POST request asking for an XHTML representation, but changing the target of the bug changes its URL, and Launchpad sends back a redirect with ws.accept= application/ json. The browser gets the JSON representation and tries to treat it like an XHTML representation, causing a crash.