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
KTOR-326 Allow to set followRedirect property for js client engine #3053
Conversation
@@ -31,13 +33,14 @@ internal class JsClientEngine(override val config: HttpClientEngineConfig) : Htt | |||
@OptIn(InternalAPI::class) | |||
override suspend fun execute(data: HttpRequestData): HttpResponseData { | |||
val callContext = callContext() | |||
val clientConfig = data.attributes[CLIENT_CONFIG] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why pass it through data? there is a property config
in class
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cause we need client config, not engine
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok. Let's create a ticket to pass client config in client factory HttpClientEngineFactory.create
method in 3.0.0 for a proper fix.
@@ -129,7 +134,7 @@ private fun Event.asString(): String = buildString { | |||
append(JSON.stringify(this@asString, arrayOf("message", "target", "type", "isTrusted"))) | |||
} | |||
|
|||
private fun io.ktor.client.fetch.Headers.mapToKtor(): Headers = buildHeaders { | |||
private fun org.w3c.fetch.Headers.mapToKtor(): Headers = buildHeaders { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are you sure this works on nodeJS? See also #2592
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In this case, we replace some types, and the actual implementation stays the same.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The tests are also fine
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unit tests? AFAIK they does not work with nodeJS production, at least 1 year ago, which results into the same problem at runtime: #2385 so you needed to create a test project and use the artifact.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will try to set up a sample
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Made a sample for node: it works
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, but please check sample with node
@@ -31,13 +33,14 @@ internal class JsClientEngine(override val config: HttpClientEngineConfig) : Htt | |||
@OptIn(InternalAPI::class) | |||
override suspend fun execute(data: HttpRequestData): HttpResponseData { | |||
val callContext = callContext() | |||
val clientConfig = data.attributes[CLIENT_CONFIG] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok. Let's create a ticket to pass client config in client factory HttpClientEngineFactory.create
method in 3.0.0 for a proper fix.
Fix KTOR-326