NewHTTPBindingEncoder creates a new encoder from the passed in request. All query and header values will be added on top of the request's existing values. Overwriting duplicate values.
(path, rawPath, query string, headers http.Header)
| 37 | // header values will be added on top of the request's existing values. Overwriting |
| 38 | // duplicate values. |
| 39 | func NewEncoderWithRawPath(path, rawPath, query string, headers http.Header) (*Encoder, error) { |
| 40 | parseQuery, err := url.ParseQuery(query) |
| 41 | if err != nil { |
| 42 | return nil, fmt.Errorf("failed to parse query string: %w", err) |
| 43 | } |
| 44 | |
| 45 | e := &Encoder{ |
| 46 | path: []byte(path), |
| 47 | rawPath: []byte(rawPath), |
| 48 | query: parseQuery, |
| 49 | header: headers.Clone(), |
| 50 | } |
| 51 | |
| 52 | return e, nil |
| 53 | } |
| 54 | |
| 55 | // Encode returns a REST protocol encoder for encoding HTTP bindings. |
| 56 | // |
no test coverage detected