mirror of
https://github.com/lukaszraczylo/graphql-monitoring-proxy.git
synced 2026-10-21 06:37:21 +00:00
Fixup govet
This commit is contained in:
+9
-13
@@ -282,23 +282,19 @@ func (suite *Tests) Test_parseGraphQLQuery() {
|
|||||||
suite.Run(tt.name, func() {
|
suite.Run(tt.name, func() {
|
||||||
cfg = &config{}
|
cfg = &config{}
|
||||||
parseConfig()
|
parseConfig()
|
||||||
ctx_headers := func() *fasthttp.RequestHeader {
|
// Create a context first, then modify its request directly
|
||||||
h := fasthttp.RequestHeader{}
|
reqCtx := &fasthttp.RequestCtx{}
|
||||||
for k, v := range tt.suppliedQuery.headers {
|
|
||||||
h.Add(k, v)
|
|
||||||
}
|
|
||||||
return &h
|
|
||||||
}()
|
|
||||||
|
|
||||||
ctx_request := fasthttp.Request{
|
// Set headers directly on the request
|
||||||
Header: *ctx_headers,
|
for k, v := range tt.suppliedQuery.headers {
|
||||||
|
reqCtx.Request.Header.Add(k, v)
|
||||||
}
|
}
|
||||||
|
|
||||||
ctx_request.AppendBody([]byte(tt.suppliedQuery.body))
|
// Set the body
|
||||||
|
reqCtx.Request.AppendBody([]byte(tt.suppliedQuery.body))
|
||||||
|
|
||||||
ctx := suite.app.AcquireCtx(&fasthttp.RequestCtx{
|
// Now create the fiber context with the request context
|
||||||
Request: ctx_request,
|
ctx := suite.app.AcquireCtx(reqCtx)
|
||||||
})
|
|
||||||
|
|
||||||
// defer func() {
|
// defer func() {
|
||||||
// cfg = &config{}
|
// cfg = &config{}
|
||||||
|
|||||||
+13
-15
@@ -87,23 +87,21 @@ func (suite *Tests) Test_proxyTheRequest() {
|
|||||||
cfg.Server.HostGraphQLReadOnly = tt.hostRO
|
cfg.Server.HostGraphQLReadOnly = tt.hostRO
|
||||||
}
|
}
|
||||||
|
|
||||||
ctx_headers := func() *fasthttp.RequestHeader {
|
// Create a request context first
|
||||||
h := fasthttp.RequestHeader{}
|
reqCtx := &fasthttp.RequestCtx{}
|
||||||
for k, v := range tt.headers {
|
|
||||||
h.Add(k, v)
|
|
||||||
}
|
|
||||||
return &h
|
|
||||||
}()
|
|
||||||
|
|
||||||
ctx_request := fasthttp.Request{
|
// Set headers directly on the request
|
||||||
Header: *ctx_headers,
|
for k, v := range tt.headers {
|
||||||
|
reqCtx.Request.Header.Add(k, v)
|
||||||
}
|
}
|
||||||
ctx_request.SetBody([]byte(tt.body))
|
|
||||||
ctx_request.SetRequestURI(tt.path)
|
// Set the body and other request properties
|
||||||
ctx_request.Header.SetMethod("POST")
|
reqCtx.Request.SetBody([]byte(tt.body))
|
||||||
ctx := suite.app.AcquireCtx(&fasthttp.RequestCtx{
|
reqCtx.Request.SetRequestURI(tt.path)
|
||||||
Request: ctx_request,
|
reqCtx.Request.Header.SetMethod("POST")
|
||||||
})
|
|
||||||
|
// Create fiber context with the request context
|
||||||
|
ctx := suite.app.AcquireCtx(reqCtx)
|
||||||
res := parseGraphQLQuery(ctx)
|
res := parseGraphQLQuery(ctx)
|
||||||
assert.NotNil(ctx, "Fiber context is nil", tt.name)
|
assert.NotNil(ctx, "Fiber context is nil", tt.name)
|
||||||
err := proxyTheRequest(ctx, res.activeEndpoint)
|
err := proxyTheRequest(ctx, res.activeEndpoint)
|
||||||
|
|||||||
Reference in New Issue
Block a user