Issuing
$.ajax({
type: 'PUT',
url: '/data/abc',
contentType: 'text/plain',
data: 'some plain text'
})
results in
> #12 PUT /data/abc
JSON body could not be parsed: Invalid JSON
< #12 200 [+3ms]
If one instead uses data: '"quoted text"', the result is:
> #13 PUT /data/abc
"quoted text"
< #13 200 [+18ms]
and similarly for {"other": "valid JSON"} strings. Note this occurs even if setting contentType: 'text/plain', as shown. The error is purely cosmetic: other operation proceeds as normal. The behavior may have been introduced in #35 in response to #33.
I also note that GET requests print their response data if it is formatted as valid JSON, but otherwise print nothing without error, i.e. they must be checking whether the response is JSON-parsable before attempting to do so. (Actually, it looks like the real distinction is that non-JSON request payloads always cause the error, while response payloads check as appropriate.)
Issuing
results in
If one instead uses
data: '"quoted text"', the result is:and similarly for
{"other": "valid JSON"}strings. Note this occurs even if settingcontentType: 'text/plain', as shown. The error is purely cosmetic: other operation proceeds as normal. The behavior may have been introduced in #35 in response to #33.I also note that GET requests print their response data if it is formatted as valid JSON, but otherwise print nothing without error, i.e. they must be checking whether the response is JSON-parsable before attempting to do so. (Actually, it looks like the real distinction is that non-JSON request payloads always cause the error, while response payloads check as appropriate.)