You can use the RestfulClient gem to test it out instead of CURL.

On Aug 19, 1:00 pm, hitch <larryhitc...@gmail.com> wrote:
> The format is determined by the HTTP Accept header, and not by adding
> an extension on the URL.
> So, your url remains  /sessions/create and not /sessions/create.xml
>
> You can test this out by using a command line tool like curl. For
> example:
>
> curl -H "Accept: application/xml" "http://localhost:3000/sessions/
> create?login=xxx&password=xxx"
>
> This should return your xml.
>
> On Aug 18, 8:28 pm, Martin Dinstuhl <mdinst...@gmail.com> wrote:
>
>
>
> > Hey everyone,
>
> >   I have been using Ruby on Rails for a few months now (I come from a
> > php / Java/J2EE background) and have been LOVING it.  I do have one
> > question regarding XML output and the SessionsController#create method
> > that is generated by the restful authentication plugin.
>
> >   I added the following code to the create method:
>
> >       #if login is successful
>
> >       respond_to do |format|
> >         format.html { redirect_back_or_default('/')}# index.html.erb
> >         format.xml  { render :xml => self.current_user }
> >       end
>
> >     #if login is not successful
>
> >       respond_to do |format|
> >         format.html { render :action => 'new'}# index.html.erb
> >         format.xml  { response.status_code.should == 401  }
> >       end
>
> >     When I try to test this like 
> > this:http://localhost:3000/sessions/create?login=myuser&password=mypassword
> > I am able to login successfully.  If I add .xml to the end of create
> > like 
> > this:http://localhost:3000/sessions/create.xml?login=myuser&password=mypas...
> > I get the following exception: No route matches "/sessions/create.xml"
> > with {:method=>:get}.  My routes.rb is pretty generic (has all of the
> > restful authentication mappings) and I haven't touched it.  Any ideas
> > as to what I'm doing wrong?  How can I log in to my site from a 3rd
> > party client?
>
> > Thanks,
> > Mark Dinstuhl
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to