Ktor: Part of URL after hash sign (#) is removed during the request

Created on 12 Jun 2019  路  5Comments  路  Source: ktorio/ktor

Ktor Version

1.2.0-rc

Ktor Engine Used(client or server and name)

ktor-client-apache:1.2.0-rc

JVM Version, Operating System and Relevant Context

Oracle JDK 8, Open JDK 11

Feedback

When trying to open an URL with # sign in URL the part after hash is completely removed

Example:

val response = client.call("https://google.com#test") {
        method = HttpMethod.Get
}.response

Actual request is going to be made to https://google.com page instead of https://google.com#test.

question

Most helpful comment

Fragment part (everything after #) assumed to be client-side only, it never should be submitted to the server.

All 5 comments

Fragment part (everything after #) assumed to be client-side only, it never should be submitted to the server.

Hi @dtolstyi, the client shouldn't send the fragment part of URL as mentioned.

OK. Thank you for information @Prototik and @e5l. I don't know how it's being done in Chrome and FireFox but they do send this part.
Anyway, if you say that it shouldn't I believe you.
Thank you!

They never send this part. It requests page without fragment and process fragment at client-side later (via js or just by using anchors). In general server doesn't know anything about fragments, you should do your stuff by yourself.

Might be (post-processing via JS in my case). Thank you @Prototik for your explanation!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

seanf picture seanf  路  3Comments

ManifoldFR picture ManifoldFR  路  4Comments

gabin8 picture gabin8  路  3Comments

PatrickLemke picture PatrickLemke  路  3Comments

baruchn picture baruchn  路  3Comments