# Bug OP-15314 - hal+json requests treated as plain html requests

Project: OpenProject
Status: closed
URL: https://community.openproject.org/work_packages/OP-15314

## Open points

_No work packages_

## Details

| Attribute | Value |
| --- | --- |
| Date |  |
| Priority | Medium |
| Module |  |
| Target versions | 14.3.0 |
| Observed in versions | 14.1.0 |
| Sprint | 14.3.0 |
| Backlog bucket |  |
| Bug found in version (deprecated) | 14.1.x |
| Found in mobile app version |  |
| Follow-up feedback e-mail |  |
| Requires doc change | No |
| Accessibility | No |
| Pull preview |  |
| List |  |
| Labels |  |

## People

| Attribute | Value |
| --- | --- |
| Assignee |  |
| Accountable | Christophe Bliard |
| Product manager |  |
| Developers |  |
| Designer |  |
| Ordered by |  |
| Signed off by |  |
| Interest by |  |

## Planning

| Attribute | Value |
| --- | --- |
| Relevance |  |

## Costs

| Attribute | Value |
| --- | --- |
| Votes |  |
| Work |  |
| Labor costs |  |

## Description

### Steps to reproduce

1.  Get basic auth token for your account in community OP instance.

2.  Make a request with curl. 

<!-- end list -->

``` bash
curl -X PATCH "https://community.openproject.org/api/v3/work_packages/35643" -u "apikey:secretapikey" -H "Content-Type:application/hal+json" --data '{"lockVersion":2,"_links":{"status":{"href":"/api/v3/statuses/10"}}}'
```

### What is the buggy behavior?

Server error. 500

``` json
{"_type":"Error","errorIdentifier":"urn:openproject-org:api:v3:errors:InternalServerError","message":"An internal error has occurred. can't convert String into Hash"}
```

### What is the expected behavior?

405 or similar error, processed by OP with error message as I don't have access to exact that ticket at community instance. Actually, it doesn't matter as param processing goes earlier.

### **Logs**

``` text
F, [2024-07-01T14:47:16.825396 #1] FATAL -- :
TypeError (can't convert String into Hash):
lib/api/v3/work_packages/parse_params_service.rb:43:in `Hash'
lib/api/v3/work_packages/parse_params_service.rb:43:in `parse_attributes'
app/services/api/parse_resource_params_service.rb:50:in `call'
lib/api/utilities/endpoints/bodied.rb:103:in `parse'
lib/api/utilities/endpoints/bodied.rb:89:in `block in mount'
```

### Environment information

Docker development container. Op

**OpenProject installation type**

- [ ] Hosted cloud edition

- [ ] Packaged installation
  
    - What distribution?

- [ ] Docker All-in-one container

- [x] Docker-compose installation

- [x] Other (please specify)

**OpenProject version**

*v14.1.1 and community instance.*

**Browser**

- [ ] Chrome
- [ ] Firefox
- [ ] Safari
- [ ] Mobile Safari
- [x] Other (please specify)

**Language**

*English*
