Ticket #193 (closed defect: fixed)

Opened 1 year ago

Last modified 1 year ago

[PATCH] #url doesn't generate correct resource URLs with :format

Reported by: chr..@oxdi.eu Assigned to:
Priority: medium Milestone: 0.4
Component: Merb Keywords:
Cc:

Description

url(:something, @something, :format => 'xml')

should produce a URL like:

/something/2.xml

but infact produces something like:

/something/2?format=xml

Attachments

formatted_resource_routes.diff (2.6 kB) - added by chr..@oxdi.eu on 09/19/07 05:04:03.
allow url(:formatted_blogposts) etc that generate formatted urls
allow_format_in_named_route_urls.diff (1.9 kB) - added by chr..@oxdi.eu on 10/03/07 08:34:00.
fixes issues with :format param in resource url generation

Change History

09/19/07 05:04:03 changed by chr..@oxdi.eu

  • attachment formatted_resource_routes.diff added.

allow url(:formatted_blogposts) etc that generate formatted urls

09/19/07 05:05:29 changed by chr..@oxdi.eu

Ideally you should not need to use a seperate "formatted_" named route.... but the Router code was too big to work through... would love if someone could make this work

10/03/07 06:11:38 changed by chr..@oxdi.eu

even worse...

?format=xxx

in the querystring doesn't actually set the :format param (seems to get overridden somewhere in router land)

10/03/07 08:34:00 changed by chr..@oxdi.eu

  • attachment allow_format_in_named_route_urls.diff added.

fixes issues with :format param in resource url generation

10/03/07 08:47:51 changed by chr..@oxdi.eu

  • summary changed from #url doesn't generate correct resource URLs with :format to [PATCH] #url doesn't generate correct resource URLs with :format.

I've submitted a second solution , that doesn't affect the router code.

This patch will:

  • add the format extension to the url unless the format is 'html'

please read the comment in the diff for more information

I found the main issue is that most people DO NOT WANT a formatted url all the time (personally I think this is like saying please peel off all the labels on the tins in my cupboard - but its an opinion thing I guess).

It would be much easier if format-less URLs did not exist for resources... since most requests are started from a browser GET request we cannot really rely on the Accept header alone and the format-extension becomes more important.

10/13/07 17:44:11 changed by iv..@gweezlebur.com

Chris, I like #2, but it doesn't have any specs. Could you write some?

11/02/07 22:08:13 changed by e.@brainspl.at

  • status changed from new to closed.
  • resolution set to fixed.

(In [818]) make :format work for url() closes #193