Skip to content

Commit

Permalink
Merge pull request #16 from OperationSpark/chore/redirect-status
Browse files Browse the repository at this point in the history
Switch redirect status from permanent to temp
  • Loading branch information
harveysanders authored Jan 16, 2023
2 parents c7bc897 + 6e0e75e commit 645a981
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion handlers/handlers.go
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ func (s *ShortyService) ServeResolver(w http.ResponseWriter, r *http.Request) {
// Redirect even if there is an error. Client should not suffer if the clicks can't be updated.
fmt.Fprintf(os.Stderr, "could not update TotalClick count: %v", err)
}
http.Redirect(w, r, link.OriginalUrl, http.StatusPermanentRedirect)
http.Redirect(w, r, link.OriginalUrl, http.StatusTemporaryRedirect)
}

func (s *ShortyService) createLink(w http.ResponseWriter, r *http.Request) {
Expand Down
2 changes: 1 addition & 1 deletion integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -396,7 +396,7 @@ func TestCreateLinkAndRedirect(t *testing.T) {

server.ServeHTTP(redirectResp, useLinkReq)

testutil.AssertStatus(t, redirectResp.Code, http.StatusPermanentRedirect)
testutil.AssertStatus(t, redirectResp.Code, http.StatusTemporaryRedirect)
testutil.AssertContains(t, redirectResp.Body.String(), originalURL)

// Check click count increment
Expand Down

0 comments on commit 645a981

Please sign in to comment.