Skip to content

Commit

Permalink
rename to Webrpc
Browse files Browse the repository at this point in the history
  • Loading branch information
LukasJenicek committed Oct 16, 2024
1 parent 1e5ccc0 commit d14b9ab
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 20 deletions.
14 changes: 7 additions & 7 deletions _examples/golang-basics/example.gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 6 additions & 6 deletions _examples/golang-imports/api.gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion client.go.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ func newRequest(ctx context.Context, url string, reqBody io.Reader, contentType
req.Header.Set("Accept", contentType)
req.Header.Set("Content-Type", contentType)
{{- if $opts.includeHeaders }}
req.Header.Set(WebRpcHeader, WebRpcHeaderValue)
req.Header.Set(WebrpcHeader, WebrpcHeaderValue)
{{- end }}
if headers, ok := HTTPRequestHeaders(ctx); ok {
for k := range headers {
Expand Down
10 changes: 5 additions & 5 deletions main.go.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,9 @@ package {{get $opts "pkg"}}

{{template "imports" dict "Types" .Types "Opts" $opts }}

const WebRpcHeader = "Webrpc"
const WebrpcHeader = "Webrpc"

const WebRpcHeaderValue = "{{ .WebrpcHeader }}"
const WebrpcHeaderValue = "{{ .WebrpcHeader }}"

// WebRPC description and code-gen version
func WebRPCVersion() string {
Expand All @@ -110,7 +110,7 @@ type WebRpcGenVersions struct {
}

func ServerVersion() (*WebRpcGenVersions, error) {
versions, err := parseWebRpcGenVersions(WebRpcHeaderValue)
versions, err := parseWebRpcGenVersions(WebrpcHeaderValue)
if err != nil {
return nil, fmt.Errorf("webrpc header is invalid: %w", err)
}
Expand All @@ -119,11 +119,11 @@ func ServerVersion() (*WebRpcGenVersions, error) {
}

func VersionFromHeader(h http.Header) (*WebRpcGenVersions, error) {
if h.Get(WebRpcHeader) == "" {
if h.Get(WebrpcHeader) == "" {
return nil, fmt.Errorf("header is empty or missing")
}

versions, err := parseWebRpcGenVersions(h.Get(WebRpcHeader))
versions, err := parseWebRpcGenVersions(h.Get(WebrpcHeader))
if err != nil {
return nil, fmt.Errorf("webrpc header is invalid: %w", err)
}
Expand Down
2 changes: 1 addition & 1 deletion server.go.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ func (s *{{$serviceName}}) ServeHTTP(w http.ResponseWriter, r *http.Request) {
}
}()

w.Header().Set(WebRpcHeader, WebRpcHeaderValue)
w.Header().Set(WebrpcHeader, WebrpcHeaderValue)

ctx := r.Context()
ctx = context.WithValue(ctx, HTTPResponseWriterCtxKey, w)
Expand Down

0 comments on commit d14b9ab

Please sign in to comment.