Hacktoberfest 2026: die Issues, die Maintainer für den Oktober markiert haben – offen und einsteigerfreundlich. Hacktoberfest-Issues durchsuchen

Trailing slash on API URLs is very, very confusing

Offen
#200 1 Kommentar 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

Bewertung

Schwierigkeit
4/5
Geschätzter Aufwand
3-5 Tage
Anfängerfreundlichkeit
25/100
Issue-Typ
Bug
Klarheit
Muss geklärt werden
Aktivitätsstatus
Veraltet
Tech-Stack
python
Bereich
api, backend

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

enhancement help wanted

@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

Beitragsleitfaden öffnen

Erste Schritte

  1. Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
  3. Forken Sie das Repository und arbeiten Sie in einem Branch.
  4. Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.

Mehr aus getpatchwork/patchwork

Alle Issues in getpatchwork/patchwork

Ähnliche Issues

Weitere Issues zu Python

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.