Hello lad
Hello lad

Reputation: 18790

Whether urlencode is needed when dealing with Flask REST API?

I have a Flask based web application running, I am not sure whether the following two urls are equivalent with respect to a Flask request

www.example.com/hello?a=Hello+G%C3%BCnter

and

www.example.com/hello?a=Hello Günter

How are these urls translated into a Flask Request internally ?

Upvotes: 0

Views: 233

Answers (1)

Bartosz Marcinkowski
Bartosz Marcinkowski

Reputation: 6861

The browser (or any other http client, like curl) should translate both of these urls into www.example.com/hello?a=Hello+G%C3%BCnter before sending to server, because www.example.com/hello?a=Hello Günter is not a valid HTTP URL. So Flask will receive www.example.com/hello?a=Hello+G%C3%BCnter in both cases, and supply it to view function arguments decoded, as "Hello Günter".

Upvotes: 1

Related Questions