Trailing slash on API URLs is very, very confusing
Dieses Issue hat noch niemand übernommen.
Bewertung
- Schwierigkeit
- 4/5
- Geschätzter Aufwand
- 3-5 Tage
- Anfängerfreundlichkeit
- 25/100
Rechercherichtung
Beginne damit, die POST- und PATCH-Anfragen an /api/patches/$NUMBER und /api/patches/$NUMBER/ zu reproduzieren. Vergleiche die Redirect-Antworten, Methoden und den resultierenden Patch-Zustand. Als erledigt gilt die Aufgabe, wenn das Verhalten der API bei URLs für einzelne Objekte konsistent und dokumentiert oder korrigiert ist, sodass Aktualisierungen nicht stillschweigend zu No-ops werden.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Beschreibung
@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?
- Vorherrschende Sprache
- Python
- Sterne
- 317
- Forks
- 91
- PR-Merge-Kennzahlen
- Keine gemergten PRs in 30 T.
Beitragsleitfaden
Erste Schritte
- Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
- Forken Sie das Repository und arbeiten Sie in einem Branch.
- Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.
Mehr aus getpatchwork/patchwork
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 68/100
getpatchwork/patchwork#668 ·
-
bug web-ui
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 74/100
getpatchwork/patchwork#546 · 2 Kommentare ·
-
Schwierigkeit 3/5 1-2 Tage Anfängerfreundlichkeit 52/100
getpatchwork/patchwork#664 ·
-
Schwierigkeit 4/5 3-5 Tage Anfängerfreundlichkeit 48/100
getpatchwork/patchwork#663 ·
-
Schwierigkeit 3/5 1-2 Tage Anfängerfreundlichkeit 45/100
getpatchwork/patchwork#645 ·
Alle Issues in getpatchwork/patchwork
Ähnliche Issues
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 75/100
anthropics/skills#1811 · 1 Kommentar ·
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 75/100
speaches-ai/speaches#678 ·
-
bug
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 75/100
datalayer/mcp-compose#42 ·
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 75/100
conda-forge/spacy-feedstock#177 ·
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 70/100
UKGovernmentBEIS/inspect_evals#2523 ·