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.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

linclark’s picture

Status: Active » Needs review
FileSize
1 KB
moshe weitzman’s picture

Status: Needs review » Reviewed & tested by the community

The Summary is clear about the benefit here is

linclark’s picture

Issue summary: View changes
webchick’s picture

Issue tags: +Quick fix

This 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.

webchick’s picture

Status: Reviewed & tested by the community » Needs review
Issue tags: +Needs tests

Well.

linclark’s picture

It 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.

linclark’s picture

Actually, a better answer for this is that the test will be covered in #2180425: PathBasedBreadcrumbBuilder should catch all exceptions from routing.

webchick’s picture

Status: Needs review » Reviewed & tested by the community

Ok 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.

webchick’s picture

Status: Reviewed & tested by the community » Fixed

Committed and pushed to 8.x. Thanks!

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.