Skip to content

Commit

Permalink
NOISSUE - Fix Content-Type header check (#238)
Browse files Browse the repository at this point in the history
* Remove charset from required content type

Signed-off-by: Dejan Mijic <[email protected]>

* Bump version to 0.2.1

Signed-off-by: Dejan Mijic <[email protected]>

* Move constant to transport.go

Signed-off-by: Dejan Mijic <[email protected]>
  • Loading branch information
mijicd authored Apr 22, 2018
1 parent 544ba57 commit f449f8b
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 6 deletions.
2 changes: 1 addition & 1 deletion manager/api/endpoint_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import (
)

const (
contentType = "application/json; charset=utf-8"
contentType = "application/json"
invalidEmail = "userexample.com"
wrongID = "123e4567-e89b-12d3-a456-000000000042"
id = "123e4567-e89b-12d3-a456-000000000001"
Expand Down
2 changes: 0 additions & 2 deletions manager/api/responses.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ import (
"github.com/mainflux/mainflux/manager"
)

const contentType = "application/json; charset=utf-8"

type apiRes interface {
code() int
headers() map[string]string
Expand Down
8 changes: 6 additions & 2 deletions manager/api/transport.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,12 @@ import (
"github.com/prometheus/client_golang/prometheus/promhttp"
)

var errUnsupportedContentType = errors.New("unsupported content type")
var errInvalidQueryParams = errors.New("invalid query params")
const contentType = "application/json"

var (
errUnsupportedContentType = errors.New("unsupported content type")
errInvalidQueryParams = errors.New("invalid query params")
)

// MakeHandler returns a HTTP handler for API endpoints.
func MakeHandler(svc manager.Service) http.Handler {
Expand Down
2 changes: 1 addition & 1 deletion version.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"net/http"
)

const version string = "0.2.0"
const version string = "0.2.1"

type response struct {
Version string
Expand Down

0 comments on commit f449f8b

Please sign in to comment.