Trailing slash on API URLs is very, very confusing
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 25/100
Direzione di ricerca
Inizia riproducendo le richieste POST e PATCH verso /api/patches/$NUMBER e /api/patches/$NUMBER/. Confronta le risposte di reindirizzamento, i metodi e lo stato risultante della patch. Il lavoro è completato quando il comportamento dell’API per l’URL di un singolo oggetto è coerente e documentato o corretto, così che gli aggiornamenti non diventino silenziosamente dei no-op.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
@stewart-ibm was complaining that his script to update patch states via the REST API wasn't working.
His script was POSTing the update to "/api/patches/$NUMBER", and receiving an HTTP 200 in response, but no update.
I did some digging and discovered that when you access "/api/patches/$NUMBER", you get back a 301 Moved Permanently to "/api/patches/$NUMBER/" (note trailing slash). It seems that when you do a POST and get a 301 in response, the behaviour is to try a GET on the redirected URL, rather than a POST.
Once I figured this out, I tried doing a POST on the correct URL with the trailing slash, got a 405 Method Not Allowed, and quickly realised the real problem was that we should have been doing a PATCH.
For good measure, I checked what happens when you send a PATCH without the trailing slash, you get a 301, my logs seem to indicate that the subsequent request to the 301 target URL is still a PATCH, yet for some reason the state doesn't update. Not sure why.
Anyway, the trailing slash thing is really confusing and I'm not sure if it's semantically appropriate for accessing an individual object.
Thoughts?
- Lingua principale
- Python
- Stelle
- 317
- Fork
- 91
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di getpatchwork/patchwork
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
getpatchwork/patchwork#668 ·
-
bug web-ui
Difficoltà 2/5 1-3 ore Idoneità per principianti 74/100
getpatchwork/patchwork#546 · 2 commenti ·
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 52/100
getpatchwork/patchwork#664 ·
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 48/100
getpatchwork/patchwork#663 ·
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 45/100
getpatchwork/patchwork#645 ·
Tutte le issue di getpatchwork/patchwork
Issue simili
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 90/100
learningequality/ricecooker#747 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
BSData/horus-heresy-3rd-edition#3171 ·
-
enhancement
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
run-llama/llama_index#23199 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 84/100
KhronosGroup/glTF-Blender-IO#2769 ·