REST API Update Bug returns error Can't use string as HASH ref in Bug.pm

RESOLVED INVALID

Status

()

RESOLVED INVALID
2 years ago
2 years ago

People

(Reporter: bid, Unassigned)

Tracking

5.0.3

Details

(Reporter)

Description

2 years ago
User Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:50.0) Gecko/20100101 Firefox/50.0
Build ID: 20161208153507

Steps to reproduce:

I am trying to update a bug via the REST API as shown here:
https://bugzilla.readthedocs.io/en/5.0/api/core/v1/bug.html#update-bug

For a minimal example, I transmit this to bugzilla:

PUT /bugzilla/rest/bug/1?token=1-HHbPqCPTWc HTTP/1.0
Content-Length: 24

{"status":"IN_PROGRESS"}


Actual results:

{
  "documentation": "https:\/\/bugzilla.readthedocs.org\/en\/5.0\/api\/",
  "error": true,
  "code": 100500,
  "message": "Can't use string (\"{\"status\":\"IN_PROGRESS\"}\") as a HASH ref while \"strict refs\" in use at \/var\/www\/html\/bugzilla\/Bugzilla\/Bug.pm line 2430.\n"
}



Expected results:

This should have changed the status of bug 1 to "CONFIRMED".

It seems like the body of the request is being passed directly to set_all instead of being parsed into a hash, but I'm not sure why this only causes an error so late in the function.
(Reporter)

Comment 1

2 years ago
Nevermind. The example was too minimal. Without the Content-Type header set to application/json, the json is not parsed.
Status: UNCONFIRMED → RESOLVED
Last Resolved: 2 years ago
Resolution: --- → INVALID
We should update the documentation.
You need to log in before you can comment on or make changes to this bug.