Skip to content

Commit

Permalink
fix: applying review comments: getting and formatting time in tha sam…
Browse files Browse the repository at this point in the history
…e line
  • Loading branch information
RawanMostafa08 committed Sep 30, 2024
1 parent 27b01c1 commit bb4e1f4
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 9 deletions.
3 changes: 1 addition & 2 deletions pkg/ginserver/ginhandler.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@ func GinHandler(c *gin.Context) {
c.String(http.StatusMethodNotAllowed, http.StatusText(http.StatusMethodNotAllowed))
return
}
currentTime := time.Now()
formattedTime := currentTime.Format(time.ANSIC)
formattedTime := time.Now().Format(time.ANSIC)

if strings.Contains(c.Request.Header.Get("content-type"), "text/plain") {
c.Writer.Header().Set("Content-Type", "text/plain")
Expand Down
3 changes: 0 additions & 3 deletions pkg/ginserver/ginhandler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,6 @@ func assertEquality(t *testing.T, obj1 any, obj2 any) {
}
}




func TestGinHome(t *testing.T) {

r := gin.Default()
Expand Down
3 changes: 1 addition & 2 deletions pkg/httpserver/httphandler.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,7 @@ func HttpHandler(w http.ResponseWriter, r *http.Request) {
http.Error(w, http.StatusText(http.StatusMethodNotAllowed), http.StatusMethodNotAllowed)
return
}
currentTime := time.Now()
formattedTime := currentTime.Format(time.ANSIC)
formattedTime := time.Now().Format(time.ANSIC)

if strings.Contains(r.Header.Get("content-type"), "text/plain") {

Expand Down
2 changes: 0 additions & 2 deletions pkg/httpserver/httphandler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import (
"reflect"
"testing"
"time"

)

func assertEquality(t *testing.T, obj1 any, obj2 any) {
Expand Down Expand Up @@ -109,4 +108,3 @@ func TestHttpHandler(t *testing.T) {
}

}

0 comments on commit bb4e1f4

Please sign in to comment.