rack-devel archive mirror (unofficial) https://groups.google.com/group/rack-devel
 help / color / mirror / Atom feed
From: dave <dwilkie@gmail.com>
To: Rack Development <rack-devel@googlegroups.com>
Subject: Constructing and parsing 'Link' header
Date: Wed, 21 Sep 2011 04:14:08 -0700 (PDT)	[thread overview]
Message-ID: <04c877d2-ef50-48a5-a32e-267f5e9bfd82@15g2000vbb.googlegroups.com> (raw)

Hi,

I've just been reading Steve's blog post here:
http://blog.steveklabnik.com/2011/08/07/some-people-understand-rest-and-http.html
about good RESTful api's. He mentions that it's a good idea to use the
'Link' header to specify links to associated resources so that clients
don't have to construct their url's.

Is there a standard way to construct and parse these heading in Rack?
I was thinking something like this for Rails apps:

request.links = [{:link => public_gists_url, :rel => "public_gists"},
{:link => repos_url, :rel => "repos"}, {:link => gists_url, :rel =>
"gists"} ]

which would product the following header: Link: </gists/public>;
rel="public_gists", </user/repos>; rel="repos", <gists>; rel="gists"

Would this be a welcome edition to rack/contrib?

                 reply	other threads:[~2011-09-21 11:22 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://groups.google.com/group/rack-devel

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=04c877d2-ef50-48a5-a32e-267f5e9bfd82@15g2000vbb.googlegroups.com \
    --to=rack-devel@googlegroups.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).