mirror of
https://github.com/ruby/ruby.git
synced 2025-08-24 21:44:30 +02:00
o protocol.rb: ProtocolError can take data
o http.rb: raise exception with response git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@739 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
eb4c6c241d
commit
fdd3d8551f
2 changed files with 31 additions and 4 deletions
|
@ -54,6 +54,20 @@ module Net
|
|||
|
||||
If called as iterator, give a part String of entity body.
|
||||
|
||||
Note:
|
||||
If status is not 2xx(success), ProtocolError exception is
|
||||
raised. At that time, you can get Response object from
|
||||
execption object. (same in head/post)
|
||||
|
||||
ex.
|
||||
|
||||
begin
|
||||
head, body = http.get(...)
|
||||
rescue ProtoRetriableError
|
||||
response = $!.data
|
||||
...
|
||||
end
|
||||
|
||||
: head( path, header = nil )
|
||||
get only header from "path" on connecting host.
|
||||
"header" is a Hash like { 'Accept' => '*/*', ... }.
|
||||
|
@ -375,7 +389,9 @@ All "key" is case-insensitive.
|
|||
end
|
||||
|
||||
def value
|
||||
error! unless SuccessCode === self
|
||||
unless SuccessCode === self then
|
||||
error! self
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue