Toggle navigation
Toggle navigation
This project
Loading...
Sign in
iOS
/
asi-http-request
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Authored by
Ben Copsey
2009-07-15 13:39:06 +0100
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
d8b4a1e76ae64bc83dc608ee758d5785d9fe4020
d8b4a1e7
1 parent
794b6ed4
Fix URLs in tests
Close postBodyReadStream when request is complete
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
4 deletions
Classes/ASIHTTPRequest.m
Classes/Tests/ASIHTTPRequestTests.m
Classes/ASIHTTPRequest.m
View file @
d8b4a1e
...
...
@@ -583,6 +583,8 @@ static NSError *ASITooMuchRedirectionError;
readStream
=
NULL
;
}
[[
self
postBodyReadStream
]
close
];
if
(
rawResponseData
)
{
[
self
setRawResponseData
:
nil
];
...
...
@@ -1027,8 +1029,6 @@ static NSError *ASITooMuchRedirectionError;
[
self
setRequestMethod
:
@"GET"
];
[
self
setPostBody
:
nil
];
[
self
setPostLength
:
0
];
[
self
setPostBodyFilePath
:
nil
];
[
self
setPostBodyWriteStream
:
nil
];
[
self
setRequestHeaders
:
nil
];
}
[
self
setURL
:[[
NSURL
URLWithString
:[
responseHeaders
valueForKey
:
@"Location"
]
relativeToURL
:[
self
url
]]
absoluteURL
]];
...
...
@@ -1356,6 +1356,8 @@ static NSError *ASITooMuchRedirectionError;
readStream
=
NULL
;
}
[[
self
postBodyReadStream
]
close
];
NSError
*
fileError
=
nil
;
// Delete up the request body temporary file, if it exists
...
...
Classes/Tests/ASIHTTPRequestTests.m
View file @
d8b4a1e
...
...
@@ -670,11 +670,11 @@
// Ensure request method changes to get
-
(
void
)
test303Redirect
{
ASIHTTPRequest
*
request
=
[
ASIHTTPRequest
requestWithURL
:[
NSURL
URLWithString
:
@"http://a
si
/ASIHTTPRequest/tests/redirect_303"
]];
ASIHTTPRequest
*
request
=
[
ASIHTTPRequest
requestWithURL
:[
NSURL
URLWithString
:
@"http://a
llseeing-i.com
/ASIHTTPRequest/tests/redirect_303"
]];
[
request
setRequestMethod
:
@"PUT"
];
[
request
appendPostData
:[
@"Fuzzy"
dataUsingEncoding
:
NSUTF8StringEncoding
]];
[
request
start
];
BOOL
success
=
[[[
request
url
]
absoluteString
]
isEqualToString
:
@"http://a
si
/ASIHTTPRequest/tests/request-method"
];
BOOL
success
=
[[[
request
url
]
absoluteString
]
isEqualToString
:
@"http://a
llseeing-i.com
/ASIHTTPRequest/tests/request-method"
];
GHAssertTrue
(
success
,
@"Failed to redirect to correct location"
);
success
=
[[
request
responseString
]
isEqualToString
:
@"GET"
];
GHAssertTrue
(
success
,
@"Failed to use GET on new URL"
);
...
...
Please
register
or
login
to post a comment