-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ktor2 extension module new HttpResponse.bodyAsSourceReader() method #54
Comments
@vanniktech I don't ktor2 have any |
Ktor does have a |
@vanniktech I double checked, and Ktor 2 doesn't have the readBuffer field, it's only available in Ktor 3. Could you please provide me with a reference where is that in ktor 2? |
I see it in my IDE: But not in the GitHub file Hint: My IDE is via a different dependency in a different module jumping to ktor3 sources, even though the module that I am in has no dependency to ktor3 :-( (I realized this just now.) It should still be possible to have an extension method on I also know why I got confused now. I also saw you using it here: and for some reason I thought I got confused that the ktor3 modules have no suffix, where as the ktor2 modules to have suffixes. Ideally, also the ktor3 modules would have their suffix; so that the name is explicit and there's parity with the properly named korlibs modules. |
@vanniktech Ktor2 is in a different branch called ‘ktor2’. I tried to use ReadByteChannel to create a SourceReader, but the main problem is that all of its functions are suspended, which broke a lot of the library code. Under the hood, it uses some kind of memory classes that are not easy to work with. |
Hmm then never mind, I heard somewhere that ktor3 is close to cutting a RC1 version so it should be stable soon. |
@vanniktech I’m closing this as I don’t have any plans to implement SourceReader for ByteChannel for Ktor 2. I suggest upgrading to Ktor 3 |
Could you provide a |
Its not extension function yet but you can do it like SourceReader.from(httpResponse.bodyAsChannel().readBuffer) |
Hi @vanniktech Sorry for the confusion. In the upcoming 0.1.6 version, you can use |
Amazing, thanks! |
|
So in the ktor2 extension module there are a few helper methods but the one I'm missing is:
I want to do all of the request handling myself but then when I get the response convert it to a
SourceReader
so that I can use Ksoup to parse it.I've already tried to do this myself with:
But I'm not getting past the error that
InternalAPI
has:which causes my build to fail. Are you using an older version of ktor or how are you getting past this restriction?
The text was updated successfully, but these errors were encountered: