Updated: Comment #N
Problem/Motivation
Currently, REST assumes the format is hal_json if no Accept/Content-Type header is provided. This results in an unhandled exception in particular situations. For example, if you don't have HAL module enabled and you run into an HttpException when are running a method such as DELETE (which shouldn't require an ACCEPT since we aren't deleting the representation, but the actual resource).
Proposed resolution
Default to JSON if no format is specified.
Comment | File | Size | Author |
---|---|---|---|
#1 | 2180111-01-rest-default-format.patch | 1 KB | linclark |
Comments
Comment #1
linclark CreditAttribution: linclark commentedComment #2
moshe weitzman CreditAttribution: moshe weitzman commentedThe Summary is clear about the benefit here is
Comment #3
linclark CreditAttribution: linclark commentedComment #4
webchickThis is easy enough to commit, but I happen to know that the reason this patch was filed was because Lin ran into issues with DELETE, which means we're lacking test coverage. If we don't add the tests here, we need a major follow-up to make sure this gets done, because regardless of why it breaks we're going to want to make sure we catch this in the future.
Comment #5
webchickWell.
Comment #6
linclark CreditAttribution: linclark commentedIt should be noted that this only breaks when the DELETE method runs into an exception. During the handling of that exception, a second exception is thrown if HAL module is not enabled, and then this second exception is unhandled. So DELETE is working fine, it's just that it depends on a non-required module in its exception condition.
I agree with Moshe that this does not require testing, but if you still disagree, then I will provide a test.
Comment #7
linclark CreditAttribution: linclark commentedActually, a better answer for this is that the test will be covered in #2180425: PathBasedBreadcrumbBuilder should catch all exceptions from routing.
Comment #8
webchickOk great, as long as tests are provided over there, this works for me.
I'll get this in later if no one else beats me to it.
Comment #9
webchickCommitted and pushed to 8.x. Thanks!