client: allow to set content-type for call
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
This commit is contained in:
parent
30baaabd9f
commit
618421de05
@ -80,6 +80,8 @@ type CallOptions struct {
|
|||||||
Backoff BackoffFunc
|
Backoff BackoffFunc
|
||||||
// Network name
|
// Network name
|
||||||
Network string
|
Network string
|
||||||
|
// Content-Type
|
||||||
|
ContentType string
|
||||||
// CallWrappers call wrappers
|
// CallWrappers call wrappers
|
||||||
CallWrappers []CallWrapper
|
CallWrappers []CallWrapper
|
||||||
// SelectOptions selector options
|
// SelectOptions selector options
|
||||||
@ -382,6 +384,13 @@ func PublishContext(ctx context.Context) PublishOption {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// WithContentType specifies call content type
|
||||||
|
func WithContentType(ct string) CallOption {
|
||||||
|
return func(o *CallOptions) {
|
||||||
|
o.ContentType = ct
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// WithAddress sets the remote addresses to use rather than using service discovery
|
// WithAddress sets the remote addresses to use rather than using service discovery
|
||||||
func WithAddress(a ...string) CallOption {
|
func WithAddress(a ...string) CallOption {
|
||||||
return func(o *CallOptions) {
|
return func(o *CallOptions) {
|
||||||
@ -486,16 +495,16 @@ func WithMessageContentType(ct string) MessageOption {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// WithContentType specifies request content type
|
// StreamingRequest specifies that request is streaming
|
||||||
func WithContentType(ct string) RequestOption {
|
func StreamingRequest(b bool) RequestOption {
|
||||||
|
return func(o *RequestOptions) {
|
||||||
|
o.Stream = b
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// RequestContentType specifies request content type
|
||||||
|
func RequestContentType(ct string) RequestOption {
|
||||||
return func(o *RequestOptions) {
|
return func(o *RequestOptions) {
|
||||||
o.ContentType = ct
|
o.ContentType = ct
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// StreamingRequest specifies that request is streaming
|
|
||||||
func StreamingRequest() RequestOption {
|
|
||||||
return func(o *RequestOptions) {
|
|
||||||
o.Stream = true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
Loading…
Reference in New Issue
Block a user