Skip to content

Instantly share code, notes, and snippets.

@mayankcpdixit
Created December 4, 2018 15:31
Show Gist options
  • Save mayankcpdixit/29f2cbea0491a520e590041e2d2151ec to your computer and use it in GitHub Desktop.
Save mayankcpdixit/29f2cbea0491a520e590041e2d2151ec to your computer and use it in GitHub Desktop.
How to add custom headers in grpc-gateway

Adding custom header to grpc request

md1 := func(context.Context, *http.Request) metadata.MD {
  return metadata.New(map[string]string{
    "custom-header": "custom-value",
  })
}

mux := runtime.NewServeMux(runtime.WithMetadata(md1))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment