Fix problems that golang inspection reported (#1158)

This commit is contained in:
gadotroee
2022-06-23 16:49:56 +03:00
committed by GitHub
parent 8c187179b0
commit a96072623f
37 changed files with 233 additions and 791 deletions

View File

@@ -91,7 +91,7 @@ func (ga *Http2Assembler) readMessage() (streamID uint32, messageHTTP1 interface
// Exactly one Framer is used for each half connection.
// (Instead of creating a new Framer for each ReadFrame operation)
// This is needed in order to decompress the headers,
// because the compression context is updated with each requests/response.
// because the compression context is updated with each request/response.
frame, err := ga.framer.ReadFrame()
if err != nil {
return

View File

@@ -14,7 +14,7 @@ import (
"github.com/up9inc/mizu/tap/api"
)
var http10protocol api.Protocol = api.Protocol{
var http10protocol = api.Protocol{
Name: "http",
LongName: "Hypertext Transfer Protocol -- HTTP/1.0",
Abbreviation: "HTTP",
@@ -28,7 +28,7 @@ var http10protocol api.Protocol = api.Protocol{
Priority: 0,
}
var http11protocol api.Protocol = api.Protocol{
var http11protocol = api.Protocol{
Name: "http",
LongName: "Hypertext Transfer Protocol -- HTTP/1.1",
Abbreviation: "HTTP",
@@ -42,7 +42,7 @@ var http11protocol api.Protocol = api.Protocol{
Priority: 0,
}
var http2Protocol api.Protocol = api.Protocol{
var http2Protocol = api.Protocol{
Name: "http",
LongName: "Hypertext Transfer Protocol Version 2 (HTTP/2)",
Abbreviation: "HTTP/2",
@@ -56,7 +56,7 @@ var http2Protocol api.Protocol = api.Protocol{
Priority: 0,
}
var grpcProtocol api.Protocol = api.Protocol{
var grpcProtocol = api.Protocol{
Name: "http",
LongName: "Hypertext Transfer Protocol Version 2 (HTTP/2) [ gRPC over HTTP/2 ]",
Abbreviation: "gRPC",
@@ -70,7 +70,7 @@ var grpcProtocol api.Protocol = api.Protocol{
Priority: 0,
}
var graphQL1Protocol api.Protocol = api.Protocol{
var graphQL1Protocol = api.Protocol{
Name: "http",
LongName: "Hypertext Transfer Protocol -- HTTP/1.1 [ GraphQL over HTTP/1.1 ]",
Abbreviation: "GQL",
@@ -84,7 +84,7 @@ var graphQL1Protocol api.Protocol = api.Protocol{
Priority: 0,
}
var graphQL2Protocol api.Protocol = api.Protocol{
var graphQL2Protocol = api.Protocol{
Name: "http",
LongName: "Hypertext Transfer Protocol Version 2 (HTTP/2) [ GraphQL over HTTP/2 ]",
Abbreviation: "GQL",

View File

@@ -66,7 +66,7 @@ func filterRequestBody(request *http.Request, options *api.TrafficFilteringOptio
if err != nil {
return
}
filteredBody, err := filterHttpBody([]byte(body), contenType, options)
filteredBody, err := filterHttpBody(body, contenType, options)
if err == nil {
request.Body = ioutil.NopCloser(bytes.NewBuffer(filteredBody))
} else {
@@ -80,7 +80,7 @@ func filterResponseBody(response *http.Response, options *api.TrafficFilteringOp
if err != nil {
return
}
filteredBody, err := filterHttpBody([]byte(body), contentType, options)
filteredBody, err := filterHttpBody(body, contentType, options)
if err == nil {
response.Body = ioutil.NopCloser(bytes.NewBuffer(filteredBody))
} else {