Mailinglist Archive: yast-devel (246 mails)

< Previous Next >
[yast-devel] Re: [yast-commit] <rest-service> master : Use format instead of content type, as it seems to set the
  • From: Klaus Kaempf <kkaempf@xxxxxxx>
  • Date: Tue, 25 Aug 2009 08:12:56 +0200
  • Message-id: <20090825061256.GA3324@xxxxxxxxxxxxx>
* Duncan Mac-Vicar P <dmacvicar@xxxxxxx> [Aug 25. 2009 00:04]:
ref: refs/heads/master
commit 72faf37c3f8dda4ab91a97f677f8833a775bded8
Author: Duncan Mac-Vicar P <dmacvicar@xxxxxxx>
Date: Tue Aug 25 00:01:33 2009 +0200

Use format instead of content type, as it seems to set the
content type too.

Hmm, this looks 'fishy' to me. Actually, both ways (@request.accept
and setting :format) should work. The (http-wise and restful) correct way is
setting the http 'accept' header to the list of mime types (yes, there
can be multiple) acceptable by the client. The server is then free to
choose one of them.

The :format is a Rails extension to support setting the mime type
via the URL. Just look at the default routes.rb entry:

map.connect ':controller/:action/:id.:format'

This is basically a regexp saying that if the url contains two slashes
and a dot its to be parsed as controller-slash-action-slash-id-dot-format

Summary: Honoring the accept header is a 'must', honoring the :format
extension a 'can'.

Hth,

Klaus
---
SUSE LINUX Products GmbH, GF: Markus Rex, HRB 16746 (AG N├╝rnberg)

--
To unsubscribe, e-mail: yast-devel+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: yast-devel+help@xxxxxxxxxxxx

< Previous Next >