You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Right now I have to specify the type in HTTP methods. E.g. Delete method usually returns no content.
I do have fetch.GetJ shortcut for fetch.Get[fetch.J], I could add fetch.DeleteNoContent or something, but I don't really like it.
However, I need to check the status of the HTTP response so I would use it like this
var url = ...
res, err := fetch.Delete[fetch.Response[string]](url)
if err != nil {
panic(err)
}
if res.Status == 200 {
// delete success
}
I don't need to specify the string. The problem is that the generic interface is not inferred
I could add fetch.NoContent for which you don't need to specify a type parameter but it would have all of the http data from fetch.Response
The text was updated successfully, but these errors were encountered:
NoContent is an HTTP status 204, could be confusing. Empty from grpc sounds better, but still not good enough. fetch.EmptyResponse is a bit long.
And I can see another use-case, what if I don't care about the body, well you can use HEAD method if the server supports it, or I could use fetch.EmptyResponse which will skip reading the body.
The name isn't clear yet, it should represent fetch.Response which does not read/marshal the body.
Right now I have to specify the type in HTTP methods. E.g. Delete method usually returns no content.
I do have
fetch.GetJ
shortcut forfetch.Get[fetch.J]
, I could addfetch.DeleteNoContent
or something, but I don't really like it.However, I need to check the status of the HTTP response so I would use it like this
I don't need to specify the string. The problem is that the generic interface is not inferred
I could add
fetch.NoContent
for which you don't need to specify a type parameter but it would have all of the http data fromfetch.Response
The text was updated successfully, but these errors were encountered: