anomaly / anomaly/gallagher

Reconsider use of `DELETE` HTTP Verb where the REST API has a `remove` operation for objects

Aperta
#56 2 commenti 0 reazioni 1 assegnatario Rivendicata da @devraj Vedi su GitHub
bug
Lingua principale
Python
Stelle
17
Fork
2
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

**Describe the bug**
I have been using the HTTP `delete` method to remove things like card assignments from a cardholder. While this works as expected, I noticed that the `PATCH` verb supports `update`, `remove` operations which allows extra attributes like `status` where we can provide reasons for the change.

```json
"cards": {
"add": [
{
"type": {
"href": "https://localhost:8904/api/card_types/354"
},
"pin": "153624"
},
{
"type": {
"href": "https://localhost:8904/api/card_types/600"
},
"number": "Jock's iPhone 8",
"status": {
"value": "Pending sign-off"
},
"invitation": {
"email": "jock@example.com"
}
}
],
"update": [
{
"href": "https://localhost:8904/api/cardholders/325/cards/97b6a24ard6d4500a9d",
"issueLevel": 2,
"until": "",
"status": {
"value": "Stolen"
},
"pin": "153624"
}
],
"remove": [
{
"href": "https://localhost:8904/api/cardholders/325/cards/77e8affe7c7e4b56",
"status": {
"value": "Lost"
}
}
]
},
```

**To Reproduce**
Not quite applicable, attempt sending the same payload via HTTP `delete` method vs http `patch`.

**Expected behavior**
- Using `DELETE` does not leave a trace
- Using `PATCH` should perform the same operation but leave an event log

**Screenshots**
NA

**Desktop (please complete the following information):**
NA

**Smartphone (please complete the following information):**
NA

**Additional context**
See REST docs.

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.