NewRequest creates a new HTTP request with auth and proper URL
(method, path string, body io.Reader)
| 159 | |
| 160 | // NewRequest creates a new HTTP request with auth and proper URL |
| 161 | func (c *rawClient) NewRequest(method, path string, body io.Reader) (*http.Request, error) { |
| 162 | url, err := url.JoinPath(c.BaseURL, path) |
| 163 | if err != nil { |
| 164 | return nil, fmt.Errorf("failed to join URL: %w", err) |
| 165 | } |
| 166 | |
| 167 | req, err := http.NewRequest(method, url, body) //nolint:gosec // G704 - URL is constructed from configured base URL |
| 168 | if err != nil { |
| 169 | return nil, err |
| 170 | } |
| 171 | |
| 172 | // Add JWT token |
| 173 | req.Header.Set("Authorization", "Bearer "+c.Token) |
| 174 | |
| 175 | return req, nil |
| 176 | } |
no test coverage detected