Closed alejandrovelez7 closed 1 year ago
@alejandrovelez7 That is a good question. In the latest release (v0.0.3) there isn't a good way to read an octet-stream
with the RESTClient
and you would need to use the raw HTTPClient
. Having said that, in trunk
, there is a new function Request
on the RESTClient
that will return the http response without doing any reading or parsing. Using that function it should be easy to adapt the code you linked in the cli repo to read an octet-stream
.
Hopefully that answers your question. Let me know if anything is unclear!
@samcoe Great! Yeah that should work nicely. Not sure if I'll have time to test out soon, but it looks similar to http's NewRequest
so I'm sure it will work. Feel free to close this out or I can add an example to the examples page once it lands if you'd like! Thanks again!
Hello!
Loving the abstraction so far, great job!
Was wondering if we could add an example that reads an
octet-stream
similar to this in the cli repo using net/http?I'm trying a couple of different approaches, but I'm not sure what's the best way to define the response to facilitate reading bytes?
Let me know if I can help in any way as well 😄
Edit: I'm using the rest client for reference, and looking at https://github.com/cli/go-gh/blob/c41a1271d97cf42ba0dcf94289da729cdb1554eb/internal/api/rest_client.go#L48 I'm not sure this is possible currently?
Using
Get
orDo
I get: