diff --git a/handlers/handlers.go b/handlers/handlers.go index 828d5aa..126b287 100644 --- a/handlers/handlers.go +++ b/handlers/handlers.go @@ -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) { diff --git a/integration_test.go b/integration_test.go index 3da0ed4..d9eed71 100644 --- a/integration_test.go +++ b/integration_test.go @@ -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