# Where's the doc for get(), post(), put(), delete() & head()?

**URL:** <https://www.ruby-forum.com/t/wheres-the-doc-for-get-post-put-delete-head/86969>\
**Category:** Rails\
**Created:** [March 25, 2006, 3:44am UTC](https://www.ruby-forum.com/t/wheres-the-doc-for-get-post-put-delete-head/86969 "2006-03-25T03:44:57Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![stephen](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/96bed5/32.png) [@stephen](https://www.ruby-forum.com/u/stephen)\
**Post date:** [March 25, 2006, 3:44am UTC](https://www.ruby-forum.com/t/wheres-the-doc-for-get-post-put-delete-head/86969/1 "2006-03-25T03:44:57Z")

</div>

These HTTP Request methods are used for testing. They are discussed in  
the testing chapter of the Agile Web D. with Rails book, as  
well as in [Peak Obsession](http://manuals.rubyonrails.com/read/chapter/28#page72) “A  
Guide to Testing the Rails”.

I want to set the encoding to multipart for a test I’m writing, but I  
can’t find any documentation to show me how. Pointing me to the source  
code for the methods would be just as good.

I’ve looked all over, and spent a good amount of time searching, so your  
help is greatly appreciated!

Thanks!

---

<div class="post-metadata">

**Author:** ![stephen](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/96bed5/32.png) [@stephen](https://www.ruby-forum.com/u/stephen)\
**Post date:** [March 25, 2006, 12:02pm UTC](https://www.ruby-forum.com/t/wheres-the-doc-for-get-post-put-delete-head/86969/2 "2006-03-25T12:02:03Z")

</div>

Maybe you have been looking in the wrong place?

I would look for info on those fx like this  
get() +http request methods

[http://www.w3.org/MarkUp/html-spec/html-spec\_8.html#SEC8.2](http://www.w3.org/MarkUp/html-spec/html-spec_8.html#SEC8.2)

> **[WDVL](https://wdvl.com)**
>
> Mastering the Art of Online Magazine Creation

etc

I would also look for  
“multipart/form-data” +“http request methods”  
found a site to do with ruby I think:  
parse talks about multi/parts encoding

this gives an example with method post  
[http://users.easystreet.com/ovid/cgi\_course/lessons/lesson\_two.html](http://users.easystreet.com/ovid/cgi_course/lessons/lesson_two.html)  
[http://wiki.modruby.net/en/?Apache%3A%3ARequest](http://wiki.modruby.net/en/?Apache%3A%3ARequest)

## I have not used forms much, so I am just giving you my ideas on how to search

View this message in context:  
[http://www.nabble.com/Where's-the-doc-for-get()%2C-post()%2C-put()%2C-delete()-head()--t1339912.html#a3585718](http://www.nabble.com/Where%27s-the-doc-for-get%28%29%2C-post%28%29%2C-put%28%29%2C-delete%28%29-head%28%29--t1339912.html#a3585718)  
Sent from the RubyOnRails Users forum at [Nabble.com](http://Nabble.com).

---

<div class="post-metadata">

**Author:** ![stephen](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/96bed5/32.png) [@stephen](https://www.ruby-forum.com/u/stephen)\
**Post date:** [March 25, 2006, 8:48pm UTC](https://www.ruby-forum.com/t/wheres-the-doc-for-get-post-put-delete-head/86969/3 "2006-03-25T20:48:00Z")

</div>

Thanks for the answer Anne, but I guess I needed to be more specific.

What I’m looking for is the RDOC for the Ruby methods that are shown in  
the testing chapter of the Agile Web D. with Rails book.  
Finding the Ruby source code for the methods would also work.

I know enough about the HTTP methods, just not enough about the actual  
Rails/Ruby method call arguments.

Thanks!  
-Steve-

anne001 wrote:

> Maybe you have been looking in the wrong place?
> 
> I would look for info on those fx like this  
> get() +http request methods
> 
> [Hypertext Markup Language - 2.0 - Forms](http://www.w3.org/MarkUp/html-spec/html-spec_8.html#SEC8.2)  
> [WDVL - Mastering the Art of Online Magazine Creation](http://wdvl.com/Internet/Protocols/HTTP/Request.html)  
> etc
> 
> I would also look for  
> “multipart/form-data” +“http request methods”  
> found a site to do with ruby I think:  
> parse talks about multi/parts encoding
> 
> this gives an example with method post  
> [http://users.easystreet.com/ovid/cgi\_course/lessons/lesson\_two.html](http://users.easystreet.com/ovid/cgi_course/lessons/lesson_two.html)  
> [http://wiki.modruby.net/en/?Apache%3A%3ARequest](http://wiki.modruby.net/en/?Apache%3A%3ARequest)
> 
> ## I have not used forms much, so I am just giving you my ideas on how to search
> 
> View this message in context:  
> [http://www.nabble.com/Where's-the-doc-for-get()%2C-post()%2C-put()%2C-delete()-head()--t1339912.html#a3585718](http://www.nabble.com/Where%27s-the-doc-for-get%28%29%2C-post%28%29%2C-put%28%29%2C-delete%28%29-head%28%29--t1339912.html#a3585718)  
> Sent from the RubyOnRails Users forum at [Nabble.com](http://Nabble.com).

---

<div class="post-metadata">

**Author:** ![stephen](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/96bed5/32.png) [@stephen](https://www.ruby-forum.com/u/stephen)\
**Post date:** [March 26, 2006, 12:02pm UTC](https://www.ruby-forum.com/t/wheres-the-doc-for-get-post-put-delete-head/86969/4 "2006-03-26T12:02:21Z")

</div>

Stephen A. wrote:

> help is greatly appreciated!  
> Unfortunately there’s no Rdoc for those methods, because they’re  
> generated in a way that the Rdoc processor can’t pick up. Deeply  
> irritating, but I’ve got them in  
> actionpack-1.11.2/action\_controller/test\_process.rb. Look for:

%w( get post put delete head ).each do |method|  
class\_eval \<\<-EOV, **FILE** , **LINE**

There’s an entry in the wiki for testing uploaded files that might be  
relevant - I’d suggest having a quick google if that’s what you’re  
trying to do. There’s some monkeying with CGI, if I remember correctly.

---

<div class="post-metadata">

**Author:** ![stephen](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/96bed5/32.png) [@stephen](https://www.ruby-forum.com/u/stephen)\
**Post date:** [March 26, 2006, 2:47pm UTC](https://www.ruby-forum.com/t/wheres-the-doc-for-get-post-put-delete-head/86969/5 "2006-03-26T14:47:26Z")

</div>

anne001 wrote:

> [http://www.ruby-doc.org/stdlib/libdoc/net/http/rdoc/classes/Net/HTTP.html](http://www.ruby-doc.org/stdlib/libdoc/net/http/rdoc/classes/Net/HTTP.html)
> 
> this is a ruby doc, it has all the key word you asked for, do you think you  
> are looking for something like that?  
> Given the context, I think he’s after Test::Unit::TestCase.{put, post,  
> get} rather that Net::HTTP.{put, post, get}.

---

<div class="post-metadata">

**Author:** ![stephen](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/96bed5/32.png) [@stephen](https://www.ruby-forum.com/u/stephen)\
**Post date:** [March 26, 2006, 10:48pm UTC](https://www.ruby-forum.com/t/wheres-the-doc-for-get-post-put-delete-head/86969/6 "2006-03-26T22:48:28Z")

</div>

Yes, this is exactly what I was looking for. I can see why the RDOC  
didn’t pick it up.

Unfortunately, I haven’t been able to determine how to set encoding to  
‘multipart/form-data’ by reading this code yet.

The wiki page on testing uploaded files doesn’t cover testing  
file\_column uploaded files at this point. I’ll add my question to the  
Wiki page, as well as any answer I come up with. When I tried to follow  
those instructions, the code failed miserably. An experiment I did  
makes me think that I might be able to set that field to a string, and  
set the post to multipart.

My experimenting so far, make me think that if your code uses the  
file\_column plugin, then you ought to be able to do something like this:

```
member_properties[:image_path] = image_path
post :create, {:member => member_properties},
   :encoding => multipart/form-data'

```

But no matter what I do, the test returns  
"test\_add\_valid\_member\_with\_image(AddMemberTest):  
TypeError: Do not know how to handle a string with value  
‘/Users/stephen/mi7/test/fixtures/images/DiamondsAndRust.jpg’ that was  
passed to a file\_column. Check if the form’s encoding has been set to  
‘multipart/form-data’.

Maybe I’m barking up the wrong tree…

But thanks for your help regardless!  
-Steve-

Alex Y. wrote:

> Stephen A. wrote:
> 
> > help is greatly appreciated!  
> > Unfortunately there’s no Rdoc for those methods, because they’re  
> > generated in a way that the Rdoc processor can’t pick up. Deeply  
> > irritating, but I’ve got them in  
> > actionpack-1.11.2/action\_controller/test\_process.rb. Look for:
> 
> %w( get post put delete head ).each do |method|  
> class\_eval \<\<-EOV, **FILE** , **LINE**
> 
> There’s an entry in the wiki for testing uploaded files that might be  
> relevant - I’d suggest having a quick google if that’s what you’re  
> trying to do. There’s some monkeying with CGI, if I remember correctly.

---

<div class="post-metadata">

**Author:** ![stephen](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/96bed5/32.png) [@stephen](https://www.ruby-forum.com/u/stephen)\
**Post date:** [March 26, 2006, 2:40pm UTC](https://www.ruby-forum.com/t/wheres-the-doc-for-get-post-put-delete-head/86969/7 "2006-03-26T14:40:01Z")

</div>

[http://www.ruby-doc.org/stdlib/libdoc/net/http/rdoc/classes/Net/HTTP.html](http://www.ruby-doc.org/stdlib/libdoc/net/http/rdoc/classes/Net/HTTP.html)

## this is a ruby doc, it has all the key word you asked for, do you think you are looking for something like that?

View this message in context:  
[http://www.nabble.com/Where's-the-doc-for-get()%2C-post()%2C-put()%2C-delete()-head()--t1339912.html#a3595912](http://www.nabble.com/Where%27s-the-doc-for-get%28%29%2C-post%28%29%2C-put%28%29%2C-delete%28%29-head%28%29--t1339912.html#a3595912)  
Sent from the RubyOnRails Users forum at [Nabble.com](http://Nabble.com).
