`DefaultHttpRequest` has been annotated as `@Inter...
# ktor
j
DefaultHttpRequest
has been annotated as
@InternalApi
. I am using it to create my own
HttpClientCall
.
Copy code
internal fun PipelineContext<Any, HttpRequestBuilder>.fakeHttpFailureClientCall(
    client: HttpClient
): HttpClientCall {
    val responseData: HttpResponseData = failureHttpResponseData(RemoteErrorOutgoing)
    val call: HttpClientCall =
        object : HttpClientCall(client) {
            val httpRequestData: HttpRequestData =
                HttpRequestBuilder()
                    .apply {
                        setBody(RemoteErrorOutgoing)
                        attributes.put(AttributeKey("ExpectSuccessAttributeKey"), false)
                    }
                    .build()

            init {
                request = DefaultHttpRequest(this, httpRequestData)
                response = DefaultHttpResponse(this, responseData)
            }
        }

    return call
}
Is there any recommendation about how to improve this implemetation?
h
What exactly do you want to do?
j
It is a custom plugin which maps errors when there is no connection and so on
There is an additional problem,
HttpResponse
forces to override an
@InternalApi
Copy code
@InternalAPI
    public abstract val rawContent: ByteReadChannel
So I cannot create my own
HttpResponse