From 4ae54d6970c7bc27851738003f10e77c8162a23a Mon Sep 17 00:00:00 2001 From: Alex Guerrieri Date: Tue, 12 Mar 2024 17:49:05 +0100 Subject: [PATCH] add context --- _examples/golang-basics/example.gen.go | 4 ++-- _examples/golang-imports/api.gen.go | 4 ++-- client.go.tmpl | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/_examples/golang-basics/example.gen.go b/_examples/golang-basics/example.gen.go index 7e841a1..7fb54e5 100644 --- a/_examples/golang-basics/example.gen.go +++ b/_examples/golang-basics/example.gen.go @@ -1,6 +1,6 @@ // example v0.0.1 8713979f949e7797d4f7506750b6e18f3b9c7c1b // -- -// Code generated by webrpc-gen@v0.15.0-dev with ../../../gen-golang generator. DO NOT EDIT. +// Code generated by webrpc-gen@v0.15.2-dev with ../../../gen-golang generator. DO NOT EDIT. // // webrpc-gen -schema=example.ridl -target=../../../gen-golang -pkg=main -server -client -legacyErrors -fixEmptyArrays -out=./example.gen.go package main @@ -646,7 +646,7 @@ func urlBase(addr string) string { // newRequest makes an http.Request from a client, adding common headers. func newRequest(ctx context.Context, url string, reqBody io.Reader, contentType string) (*http.Request, error) { - req, err := http.NewRequest("POST", url, reqBody) + req, err := http.NewRequestWithContext(ctx, "POST", url, reqBody) if err != nil { return nil, err } diff --git a/_examples/golang-imports/api.gen.go b/_examples/golang-imports/api.gen.go index 5844b47..81ce551 100644 --- a/_examples/golang-imports/api.gen.go +++ b/_examples/golang-imports/api.gen.go @@ -1,6 +1,6 @@ // example-api-service v1.0.0 eb9a5d4082a36a8cb84eaa4b3e1091fc4f1f6f3d // -- -// Code generated by webrpc-gen@v0.15.0-dev with ../../../gen-golang generator. DO NOT EDIT. +// Code generated by webrpc-gen@v0.15.2-dev with ../../../gen-golang generator. DO NOT EDIT. // // webrpc-gen -schema=./proto/api.ridl -target=../../../gen-golang -out=./api.gen.go -pkg=main -server -client -legacyErrors=true -fmt=false package main @@ -393,7 +393,7 @@ func urlBase(addr string) string { // newRequest makes an http.Request from a client, adding common headers. func newRequest(ctx context.Context, url string, reqBody io.Reader, contentType string) (*http.Request, error) { - req, err := http.NewRequest("POST", url, reqBody) + req, err := http.NewRequestWithContext(ctx, "POST", url, reqBody) if err != nil { return nil, err } diff --git a/client.go.tmpl b/client.go.tmpl index c11b9a1..1b5ed62 100644 --- a/client.go.tmpl +++ b/client.go.tmpl @@ -201,7 +201,7 @@ func urlBase(addr string) string { // newRequest makes an http.Request from a client, adding common headers. func newRequest(ctx context.Context, url string, reqBody io.Reader, contentType string) (*http.Request, error) { - req, err := http.NewRequest("POST", url, reqBody) + req, err := http.NewRequestWithContext(ctx, "POST", url, reqBody) if err != nil { return nil, err } @@ -295,4 +295,4 @@ func HTTPRequestHeaders(ctx context.Context) (http.Header, bool) { } {{- end -}} -{{- end -}} \ No newline at end of file +{{- end -}}