fix: handle different response
This commit is contained in:
parent
70ea463f60
commit
882756ef3a
|
@ -1966,7 +1966,7 @@ type WebhookLog {
|
||||||
|
|
||||||
type TestEndpointResponse {
|
type TestEndpointResponse {
|
||||||
http_status: Int64
|
http_status: Int64
|
||||||
response: Map
|
response: String
|
||||||
}
|
}
|
||||||
|
|
||||||
type WebhookLogs {
|
type WebhookLogs {
|
||||||
|
@ -7292,9 +7292,9 @@ func (ec *executionContext) _TestEndpointResponse_response(ctx context.Context,
|
||||||
if resTmp == nil {
|
if resTmp == nil {
|
||||||
return graphql.Null
|
return graphql.Null
|
||||||
}
|
}
|
||||||
res := resTmp.(map[string]interface{})
|
res := resTmp.(*string)
|
||||||
fc.Result = res
|
fc.Result = res
|
||||||
return ec.marshalOMap2map(ctx, field.Selections, res)
|
return ec.marshalOString2ᚖstring(ctx, field.Selections, res)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (ec *executionContext) _User_id(ctx context.Context, field graphql.CollectedField, obj *model.User) (ret graphql.Marshaler) {
|
func (ec *executionContext) _User_id(ctx context.Context, field graphql.CollectedField, obj *model.User) (ret graphql.Marshaler) {
|
||||||
|
|
|
@ -228,8 +228,8 @@ type TestEndpointRequest struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
type TestEndpointResponse struct {
|
type TestEndpointResponse struct {
|
||||||
HTTPStatus *int64 `json:"http_status"`
|
HTTPStatus *int64 `json:"http_status"`
|
||||||
Response map[string]interface{} `json:"response"`
|
Response *string `json:"response"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type UpdateAccessInput struct {
|
type UpdateAccessInput struct {
|
||||||
|
|
|
@ -177,7 +177,7 @@ type WebhookLog {
|
||||||
|
|
||||||
type TestEndpointResponse {
|
type TestEndpointResponse {
|
||||||
http_status: Int64
|
http_status: Int64
|
||||||
response: Map
|
response: String
|
||||||
}
|
}
|
||||||
|
|
||||||
type WebhookLogs {
|
type WebhookLogs {
|
||||||
|
|
|
@ -173,7 +173,5 @@ func (r *Resolver) Mutation() generated.MutationResolver { return &mutationResol
|
||||||
// Query returns generated.QueryResolver implementation.
|
// Query returns generated.QueryResolver implementation.
|
||||||
func (r *Resolver) Query() generated.QueryResolver { return &queryResolver{r} }
|
func (r *Resolver) Query() generated.QueryResolver { return &queryResolver{r} }
|
||||||
|
|
||||||
type (
|
type mutationResolver struct{ *Resolver }
|
||||||
mutationResolver struct{ *Resolver }
|
type queryResolver struct{ *Resolver }
|
||||||
queryResolver struct{ *Resolver }
|
|
||||||
)
|
|
||||||
|
|
|
@ -96,17 +96,9 @@ func TestEndpointResolver(ctx context.Context, params model.TestEndpointRequest)
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
response := map[string]interface{}{}
|
|
||||||
if string(body) != "" {
|
|
||||||
if err := json.Unmarshal(body, &response); err != nil {
|
|
||||||
log.Debug("error un-marshalling response: ", err)
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
statusCode := int64(resp.StatusCode)
|
statusCode := int64(resp.StatusCode)
|
||||||
return &model.TestEndpointResponse{
|
return &model.TestEndpointResponse{
|
||||||
HTTPStatus: &statusCode,
|
HTTPStatus: &statusCode,
|
||||||
Response: response,
|
Response: refs.NewStringRef(string(body)),
|
||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user