(ctx context.Context, field schema.Field)
| 701 | } |
| 702 | |
| 703 | func (hr *httpResolver) rewriteAndExecute(ctx context.Context, field schema.Field) *Resolved { |
| 704 | hrc, err := field.CustomHTTPConfig() |
| 705 | if err != nil { |
| 706 | return EmptyResult(field, err) |
| 707 | } |
| 708 | |
| 709 | // If this is a lambda field, it will always have a body template. |
| 710 | // Just convert that into a lambda template. |
| 711 | if field.HasLambdaDirective() { |
| 712 | hrc.Template = schema.GetBodyForLambda(ctx, field, nil, hrc.Template) |
| 713 | } |
| 714 | |
| 715 | fieldData, errs, hardErrs := hrc.MakeAndDecodeHTTPRequest(hr.Client, hrc.URL, hrc.Template, |
| 716 | field) |
| 717 | if hardErrs != nil { |
| 718 | // Not using EmptyResult() here as we don't want to wrap the errors returned from remote |
| 719 | // endpoints |
| 720 | return &Resolved{ |
| 721 | Data: field.NullResponse(), |
| 722 | Field: field, |
| 723 | Err: hardErrs, |
| 724 | } |
| 725 | } |
| 726 | |
| 727 | return DataResult(field, map[string]interface{}{field.Name(): fieldData}, errs) |
| 728 | } |
| 729 | |
| 730 | func (h *httpQueryResolver) Resolve(ctx context.Context, query schema.Query) *Resolved { |
| 731 | return (*httpResolver)(h).Resolve(ctx, query) |
no test coverage detected