Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

Trailing slash on API URLs is very, very confusing

Aperta
#200 1 commento 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
25/100
Tipo di issue
Bug
Chiarezza
Da chiarire
Stato di attività
Ferma
Stack tecnologico
python
Ambito
api, backend

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

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?

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

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di getpatchwork/patchwork

Tutte le issue di getpatchwork/patchwork

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.