mirror of
https://github.com/lukaszraczylo/graphql-monitoring-proxy.git
synced 2026-10-21 06:37:21 +00:00
fixup! Staticheck fixes
This commit is contained in:
+6
-14
@@ -282,23 +282,15 @@ 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 {
|
ctx := suite.app.AcquireCtx(&fasthttp.RequestCtx{})
|
||||||
h := fasthttp.RequestHeader{}
|
|
||||||
for k, v := range tt.suppliedQuery.headers {
|
|
||||||
h.Add(k, v)
|
|
||||||
}
|
|
||||||
return &h
|
|
||||||
}()
|
|
||||||
|
|
||||||
ctx_request := fasthttp.Request{
|
// Set headers
|
||||||
Header: *ctx_headers,
|
for k, v := range tt.suppliedQuery.headers {
|
||||||
|
ctx.Request().Header.Add(k, v)
|
||||||
}
|
}
|
||||||
|
|
||||||
ctx_request.AppendBody([]byte(tt.suppliedQuery.body))
|
// Set body
|
||||||
|
ctx.Request().AppendBody([]byte(tt.suppliedQuery.body))
|
||||||
ctx := suite.app.AcquireCtx(&fasthttp.RequestCtx{
|
|
||||||
Request: ctx_request,
|
|
||||||
})
|
|
||||||
|
|
||||||
// defer func() {
|
// defer func() {
|
||||||
// cfg = &config{}
|
// cfg = &config{}
|
||||||
|
|||||||
+9
-15
@@ -87,23 +87,17 @@ func (suite *Tests) Test_proxyTheRequest() {
|
|||||||
cfg.Server.HostGraphQLReadOnly = tt.hostRO
|
cfg.Server.HostGraphQLReadOnly = tt.hostRO
|
||||||
}
|
}
|
||||||
|
|
||||||
ctx_headers := func() *fasthttp.RequestHeader {
|
ctx := suite.app.AcquireCtx(&fasthttp.RequestCtx{})
|
||||||
h := fasthttp.RequestHeader{}
|
|
||||||
for k, v := range tt.headers {
|
|
||||||
h.Add(k, v)
|
|
||||||
}
|
|
||||||
return &h
|
|
||||||
}()
|
|
||||||
|
|
||||||
ctx_request := fasthttp.Request{
|
// Set headers
|
||||||
Header: *ctx_headers,
|
for k, v := range tt.headers {
|
||||||
|
ctx.Request().Header.Add(k, v)
|
||||||
}
|
}
|
||||||
ctx_request.SetBody([]byte(tt.body))
|
|
||||||
ctx_request.SetRequestURI(tt.path)
|
// Set body and other request properties
|
||||||
ctx_request.Header.SetMethod("POST")
|
ctx.Request().SetBody([]byte(tt.body))
|
||||||
ctx := suite.app.AcquireCtx(&fasthttp.RequestCtx{
|
ctx.Request().SetRequestURI(tt.path)
|
||||||
Request: ctx_request,
|
ctx.Request().Header.SetMethod("POST")
|
||||||
})
|
|
||||||
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