3 ms·
> Also, I'm not a Go developer but is this idiomatic? The error handling is kinda strange. I would do some like this: var ErrUnexpectedResponse = errors.
by jpittis 11y ago
> Also, I'm not a Go developer but is this idiomatic?
The error handling is kinda strange.
I would do some like this:
var ErrUnexpectedResponse = errors.New("unexpected response")
....
func syntheticHttpRequest(url string, apiToken string) error {
...
} else if resp.StatusCode != 202 {
return ErrUnexpectedResponse
}
return nil
}
(a bunch of other stuff was mentioned in the comments)
- weberc2 11y agoWhat's strange about this?