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
2011-08-06 14:30:43 +0100
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
6eac3fbec87944a0e37fd11c86a1213fbe0e2d4b
6eac3fbe
1 parent
e7fff59c
Add test to ensure gh-211 stays fixed
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
30 additions
and
1 deletions
Classes/ASIHTTPRequest.m
Classes/Tests/ASIDownloadCacheTests.m
Mac.xcodeproj/project.pbxproj
Classes/ASIHTTPRequest.m
View file @
6eac3fb
...
...
@@ -24,7 +24,7 @@
#import "ASIDataCompressor.h"
// Automatically set on build
NSString
*
ASIHTTPRequestVersion
=
@"v1.8.1-2
3
2011-08-06"
;
NSString
*
ASIHTTPRequestVersion
=
@"v1.8.1-2
6
2011-08-06"
;
static
NSString
*
defaultUserAgent
=
nil
;
...
...
Classes/Tests/ASIDownloadCacheTests.m
View file @
6eac3fb
...
...
@@ -506,4 +506,33 @@
[
request
redirectToURL
:
newURL
];
}
-
(
void
)
testCachedFileOverwritten
{
// Test for https://github.com/pokeb/asi-http-request/pull/211
// This test ensures that items in the cache are correctly overwritten when a downloadDestinationPath is set,
// and they need to be copied to the cache at the end of the request
// This url returns different content every time
NSURL
*
url
=
[
NSURL
URLWithString
:
@"http://asi/ASIHTTPRequest/tests/random-content"
];
ASIHTTPRequest
*
request
=
[
ASIHTTPRequest
requestWithURL
:
url
];
[
request
setDownloadCache
:[
ASIDownloadCache
sharedCache
]];
[
request
setSecondsToCache
:
0
.
5
f
];
[
request
startSynchronous
];
NSString
*
path
=
[[
ASIDownloadCache
sharedCache
]
pathToCachedResponseDataForURL
:
url
];
NSString
*
content
=
[
NSString
stringWithContentsOfFile
:
path
encoding
:
NSUTF8StringEncoding
error
:
NULL
];
sleep
(
1
);
request
=
[
ASIHTTPRequest
requestWithURL
:
url
];
[
request
setDownloadCache
:[
ASIDownloadCache
sharedCache
]];
[
request
setDownloadDestinationPath
:[[
self
filePathForTemporaryTestFiles
]
stringByAppendingPathComponent
:
@"test.html"
]];
[
request
startSynchronous
];
NSString
*
content2
=
[
NSString
stringWithContentsOfFile
:
path
encoding
:
NSUTF8StringEncoding
error
:
NULL
];
BOOL
success
=
!
[
content
isEqualToString
:
content2
];
GHAssertTrue
(
success
,
@"Failed to overwrite response in cache"
);
}
@end
...
...
Mac.xcodeproj/project.pbxproj
View file @
6eac3fb
This diff was suppressed by a .gitattributes entry.
Please
register
or
login
to post a comment