Skip to content
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

[FEATURE REQUEST] Urlparam is case insensitive #1869

Closed
aadog opened this issue Mar 28, 2022 · 1 comment
Closed

[FEATURE REQUEST] Urlparam is case insensitive #1869

aadog opened this issue Mar 28, 2022 · 1 comment
Assignees

Comments

@aadog
Copy link

aadog commented Mar 28, 2022

Is your feature request related to a problem? Please describe.
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

It's frustrating when urlparam gets the case. Most web frameworks are not case sensitive

Describe the solution you'd like
A clear and concise description of what you want to happen.

[FEATURE REQUEST] Urlparam is case insensitive

Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.

ctx.URLParam("A")=ctx.URLParam("b")

It's better to iris.New can be used as only one option

Additional context
Add any other context or screenshots about the feature request here.

@kataras
Copy link
Owner

kataras commented Apr 2, 2022

Hello @aadog,

The parameters should always be in lowercase, because that's how they are passed from clients. So ctx.URLParam("a") reads both ?a=test and ?A=test. That's the default behavior of the standard net/http package and other http language frameworks from C# to python.

package main

import "github.com/kataras/iris/v12"

func main() {
	app := iris.New()
	app.Get("/", handler)

	// http://localhost:8080?a=test
	// http://localhost:8080?A=test
	app.Listen(":8080")
}

func handler(ctx iris.Context) {
	a := ctx.URLParam("a")
	ctx.Writef("parameter A = %s", a)
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants