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