message options
This commit is contained in:
		
							
								
								
									
										4
									
								
								http.go
									
									
									
									
									
								
							
							
						
						
									
										4
									
								
								http.go
									
									
									
									
									
								
							| @@ -180,8 +180,8 @@ func (h *httpClient) Options() client.Options { | ||||
| 	return h.opts | ||||
| } | ||||
|  | ||||
| func (h *httpClient) NewMessage(topic string, msg interface{}) client.Message { | ||||
| 	return newHTTPMessage(topic, msg, "application/proto") | ||||
| func (h *httpClient) NewMessage(topic string, msg interface{}, opts ...client.MessageOption) client.Message { | ||||
| 	return newHTTPMessage(topic, msg, "application/proto", opts...) | ||||
| } | ||||
|  | ||||
| func (h *httpClient) NewRequest(service, method string, req interface{}, reqOpts ...client.RequestOption) client.Request { | ||||
|   | ||||
							
								
								
									
										11
									
								
								message.go
									
									
									
									
									
								
							
							
						
						
									
										11
									
								
								message.go
									
									
									
									
									
								
							| @@ -10,7 +10,16 @@ type httpMessage struct { | ||||
| 	payload     interface{} | ||||
| } | ||||
|  | ||||
| func newHTTPMessage(topic string, payload interface{}, contentType string) client.Message { | ||||
| func newHTTPMessage(topic string, payload interface{}, contentType string, opts ...client.MessageOption) client.Message { | ||||
| 	var options client.MessageOptions | ||||
| 	for _, o := range opts { | ||||
| 		o(&options) | ||||
| 	} | ||||
|  | ||||
| 	if len(options.ContentType) > 0 { | ||||
| 		contentType = options.ContentType | ||||
| 	} | ||||
|  | ||||
| 	return &httpMessage{ | ||||
| 		payload:     payload, | ||||
| 		topic:       topic, | ||||
|   | ||||
		Reference in New Issue
	
	Block a user