|
|
@ -14,10 +14,9 @@ var ( |
|
|
|
// Transport is an HTTP transport.
|
|
|
|
// Transport is an HTTP transport.
|
|
|
|
type Transport struct { |
|
|
|
type Transport struct { |
|
|
|
endpoint string |
|
|
|
endpoint string |
|
|
|
path string |
|
|
|
|
|
|
|
method string |
|
|
|
|
|
|
|
operation string |
|
|
|
operation string |
|
|
|
header headerCarrier |
|
|
|
header headerCarrier |
|
|
|
|
|
|
|
request *http.Request |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// Kind returns the transport kind.
|
|
|
|
// Kind returns the transport kind.
|
|
|
@ -40,24 +39,9 @@ func (tr *Transport) Header() transport.Header { |
|
|
|
return tr.header |
|
|
|
return tr.header |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// Path returns the Transport path from server context.
|
|
|
|
// Request returns the transport request.
|
|
|
|
func Path(ctx context.Context) string { |
|
|
|
func (tr *Transport) Request() *http.Request { |
|
|
|
if tr, ok := transport.FromServerContext(ctx); ok { |
|
|
|
return tr.request |
|
|
|
if tr, ok := tr.(*Transport); ok { |
|
|
|
|
|
|
|
return tr.path |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return "" |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Method returns the Transport method from server context.
|
|
|
|
|
|
|
|
func Method(ctx context.Context) string { |
|
|
|
|
|
|
|
if tr, ok := transport.FromServerContext(ctx); ok { |
|
|
|
|
|
|
|
if tr, ok := tr.(*Transport); ok { |
|
|
|
|
|
|
|
return tr.method |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return "" |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// SetOperation sets the transport operation.
|
|
|
|
// SetOperation sets the transport operation.
|
|
|
|