mirror of
https://github.com/go-micro/go-micro.git
synced 2025-08-04 21:42:57 +02:00
fix: some linting issues (#2563)
This commit is contained in:
@ -13,7 +13,7 @@ import (
|
||||
"go-micro.dev/v4/selector"
|
||||
)
|
||||
|
||||
// Write sets the status and body on a http ResponseWriter
|
||||
// Write sets the status and body on a http ResponseWriter.
|
||||
func Write(w http.ResponseWriter, contentType string, status int, body string) {
|
||||
w.Header().Set("Content-Length", fmt.Sprintf("%v", len(body)))
|
||||
w.Header().Set("Content-Type", contentType)
|
||||
@ -21,7 +21,7 @@ func Write(w http.ResponseWriter, contentType string, status int, body string) {
|
||||
fmt.Fprintf(w, `%v`, body)
|
||||
}
|
||||
|
||||
// WriteBadRequestError sets a 400 status code
|
||||
// WriteBadRequestError sets a 400 status code.
|
||||
func WriteBadRequestError(w http.ResponseWriter, err error) {
|
||||
rawBody, err := json.Marshal(map[string]string{
|
||||
"error": err.Error(),
|
||||
@ -33,7 +33,7 @@ func WriteBadRequestError(w http.ResponseWriter, err error) {
|
||||
Write(w, "application/json", 400, string(rawBody))
|
||||
}
|
||||
|
||||
// WriteInternalServerError sets a 500 status code
|
||||
// WriteInternalServerError sets a 500 status code.
|
||||
func WriteInternalServerError(w http.ResponseWriter, err error) {
|
||||
rawBody, err := json.Marshal(map[string]string{
|
||||
"error": err.Error(),
|
||||
|
@ -77,5 +77,4 @@ func TestRoundTripper(t *testing.T) {
|
||||
if string(b) != "hello world" {
|
||||
t.Fatal("response is", string(b))
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user