visionmedia / express-resource

Resourceful routing for Express
1.41k stars 140 forks source link

Prevent .:format for e-mail addresses in url? #48

Closed PatrickHeneise closed 12 years ago

PatrickHeneise commented 12 years ago

I'm authenticating with google and using the e-mail address as user name. For user/show the URL is /user/abc@abc.com. This will always download a file abc@abc.com, even though it should res.render 'user/show'. How can I prevent that? I tried setting req.format and req.params.format to undefined, but didn't work.

tj commented 12 years ago

ideally we'd just use Accept, since that's what it's for

PatrickHeneise commented 12 years ago

header.accept = "text/plain", or how do I do that?

tj commented 12 years ago

alternatively we could white-list formats, but then that gets a bit opinionated and messy, but otherwise it's ambiguous

tj commented 12 years ago

but yeah we would just parse Accept's values/qualities and see if any of those formats are available

PatrickHeneise commented 12 years ago

res.contentType('text/html');

Thanks!

kb19 commented 11 years ago

I just ran into this issue, passing an email in the url. Where did you put that res.contentType('text/html') code?