Skip to content

Commit 9cd7e51

Browse files
authored
Merge pull request #181 from arran4/fix-redirect-405-error-7743134787219650796
Fix 405 Method Not Allowed error on redirect after POST
2 parents f3587c8 + 563a365 commit 9cd7e51

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

autoRefreshPage.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,5 +27,5 @@ func TaskDoneAutoRefreshPage(w http.ResponseWriter, r *http.Request) error {
2727
func taskRedirectWithoutQueryArgs(w http.ResponseWriter, r *http.Request) {
2828
u := r.URL
2929
u.RawQuery = ""
30-
http.Redirect(w, r, u.String(), http.StatusTemporaryRedirect)
30+
http.Redirect(w, r, u.String(), http.StatusSeeOther)
3131
}

bookmarkActionHandlers.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ func BookmarksEditSaveAction(w http.ResponseWriter, r *http.Request) error {
3333
if p := providerFromContext(r.Context()); p != nil {
3434
if err := p.CreateRepo(r.Context(), login, token, repoName); err == nil {
3535
if err := CreateBookmarks(r.Context(), login, token, branch, text); err == nil {
36-
http.Redirect(w, r, "/edit?ref=refs/heads/"+branch, http.StatusTemporaryRedirect)
36+
http.Redirect(w, r, "/edit?ref=refs/heads/"+branch, http.StatusSeeOther)
3737
return ErrHandled
3838
}
3939
}

cmd/gobookmarks/serve.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -641,7 +641,7 @@ func runTemplate(tmpl string) func(http.ResponseWriter, *http.Request) {
641641

642642
func redirectToHandler(toUrl string) func(http.ResponseWriter, *http.Request) {
643643
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
644-
http.Redirect(w, r, toUrl, http.StatusTemporaryRedirect)
644+
http.Redirect(w, r, toUrl, http.StatusSeeOther)
645645
})
646646
}
647647

@@ -668,7 +668,7 @@ func redirectToHandlerBranchToRef(toUrl string) func(http.ResponseWriter, *http.
668668
qs.Set("edit", edit)
669669
}
670670
u.RawQuery = qs.Encode()
671-
http.Redirect(w, r, u.String(), http.StatusTemporaryRedirect)
671+
http.Redirect(w, r, u.String(), http.StatusSeeOther)
672672
})
673673
}
674674

@@ -684,7 +684,7 @@ func redirectToHandlerTabPage(toUrl string) func(http.ResponseWriter, *http.Requ
684684
qs.Set("edit", edit)
685685
}
686686
u.RawQuery = qs.Encode()
687-
http.Redirect(w, r, u.String(), http.StatusTemporaryRedirect)
687+
http.Redirect(w, r, u.String(), http.StatusSeeOther)
688688
})
689689
}
690690

0 commit comments

Comments
 (0)