KorGE

    • Register
    • Login
    • Search
    • Recent
    • Tags
    • Popular
    • Users
    • Groups

    Networking in browser

    Support
    1
    1
    93
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • G
      Gal Bachar last edited by

      This is part of HttpClient impl:

      suspend fun request(
      	method: Http.Method,
      	url: String,
      	headers: Http.Headers = Http.Headers(),
      	content: AsyncStream? = null,
      	config: RequestConfig = RequestConfig()
      ): Response {
      	//println("HttpClient.request: $method:$url")
      	val contentLength = content?.getLength() ?: 0L
      	var actualHeaders = headers
      
      	if (content != null && !headers.any { it.first.equals(Http.Headers.ContentLength, ignoreCase = true) }) {
      		actualHeaders = actualHeaders.withReplaceHeaders(Http.Headers.ContentLength to "$contentLength")
      	}
      
      	if (config.simulateBrowser) {
              actualHeaders = combineHeadersForHost(actualHeaders, null)
      	}
      
      	val response =
      		requestInternal(method, url, actualHeaders, content).apply { if (config.throwErrors) checkErrors() }
      

      For some reason it forces content-length header which throws error non-stops:

      226b247c-2d65-4618-a587-391cd5bf45ff-image.png

      How to continue? It's impossible to override the current impl because of requestInternal() which isn't available outside this scope

      1 Reply Last reply Reply Quote 0
      • First post
        Last post