fix: handle different response
This commit is contained in:
parent
70ea463f60
commit
882756ef3a
|
@ -1966,7 +1966,7 @@ type WebhookLog {
|
|||
|
||||
type TestEndpointResponse {
|
||||
http_status: Int64
|
||||
response: Map
|
||||
response: String
|
||||
}
|
||||
|
||||
type WebhookLogs {
|
||||
|
@ -7292,9 +7292,9 @@ func (ec *executionContext) _TestEndpointResponse_response(ctx context.Context,
|
|||
if resTmp == nil {
|
||||
return graphql.Null
|
||||
}
|
||||
res := resTmp.(map[string]interface{})
|
||||
res := resTmp.(*string)
|
||||
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) {
|
||||
|
|
|
@ -229,7 +229,7 @@ type TestEndpointRequest struct {
|
|||
|
||||
type TestEndpointResponse struct {
|
||||
HTTPStatus *int64 `json:"http_status"`
|
||||
Response map[string]interface{} `json:"response"`
|
||||
Response *string `json:"response"`
|
||||
}
|
||||
|
||||
type UpdateAccessInput struct {
|
||||
|
|
|
@ -177,7 +177,7 @@ type WebhookLog {
|
|||
|
||||
type TestEndpointResponse {
|
||||
http_status: Int64
|
||||
response: Map
|
||||
response: String
|
||||
}
|
||||
|
||||
type WebhookLogs {
|
||||
|
|
|
@ -173,7 +173,5 @@ func (r *Resolver) Mutation() generated.MutationResolver { return &mutationResol
|
|||
// Query returns generated.QueryResolver implementation.
|
||||
func (r *Resolver) Query() generated.QueryResolver { return &queryResolver{r} }
|
||||
|
||||
type (
|
||||
mutationResolver struct{ *Resolver }
|
||||
queryResolver struct{ *Resolver }
|
||||
)
|
||||
type mutationResolver struct{ *Resolver }
|
||||
type queryResolver struct{ *Resolver }
|
||||
|
|
|
@ -96,17 +96,9 @@ func TestEndpointResolver(ctx context.Context, params model.TestEndpointRequest)
|
|||
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)
|
||||
return &model.TestEndpointResponse{
|
||||
HTTPStatus: &statusCode,
|
||||
Response: response,
|
||||
Response: refs.NewStringRef(string(body)),
|
||||
}, nil
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user