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-01-05 23:06:59 +0000
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
0b59da743b6b7207f75322ff0b54b1c859a82e0d
0b59da74
1 parent
7e2b9e66
Reapply tweaks to FormDataRequest tests to ensure they pass
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
2 deletions
ASIFormDataRequestTests.m
ASIFormDataRequestTests.m
View file @
0b59da7
...
...
@@ -23,20 +23,27 @@
[
data
writeToFile
:
path
atomically
:
NO
];
ASIFormDataRequest
*
request
=
[[[
ASIFormDataRequest
alloc
]
initWithURL
:
url
]
autorelease
];
NSDate
*
d
=
[
NSDate
new
];
NSValue
*
v
=
[
NSValue
valueWithRect
:
NSMakeRect
(
0
,
0
,
200
,
200
)];
[
request
setPostValue
:
@"foo"
forKey
:
@"post_var"
];
[
request
setPostValue
:
d
forKey
:
@"post_var2"
];
[
request
setPostValue
:
v
forKey
:
@"post_var3"
];
[
request
setFile
:
path
forKey
:
@"file"
];
[
request
start
];
BOOL
success
=
([[
request
dataString
]
isEqualToString
:[
NSString
stringWithFormat
:
@"post_var: %@
\r\n
file_name: %@
\r\n
file_size: %hu"
,
@"foo"
,
@"bigfile"
,
size
]]);
BOOL
success
=
([[
request
dataString
]
isEqualToString
:[
NSString
stringWithFormat
:
@"post_var: %@
\r\n
post_var2: %@
\r\n
post_var3: %@
\r\n
file_name: %@
\r\n
file_size: %hu"
,
@"foo"
,
d
,
v
,
@"bigfile"
,
size
]]);
STAssertTrue
(
success
,
@"Failed to upload the correct data (using local file)"
);
//Try the same with the raw data
request
=
[[[
ASIFormDataRequest
alloc
]
initWithURL
:
url
]
autorelease
];
[
request
setPostValue
:
@"foo"
forKey
:
@"post_var"
];
[
request
setPostValue
:
d
forKey
:
@"post_var2"
];
[
request
setPostValue
:
v
forKey
:
@"post_var3"
];
[
request
setData
:
data
forKey
:
@"file"
];
[
request
start
];
success
=
([[
request
dataString
]
isEqualToString
:[
NSString
stringWithFormat
:
@"post_var: %@
\r\n
file_name: %@
\r\n
file_size: %hu"
,
@"foo"
,
@"file"
,
size
]]);
success
=
([[
request
dataString
]
isEqualToString
:[
NSString
stringWithFormat
:
@"post_var: %@
\r\n
post_var2: %@
\r\n
post_var3: %@
\r\n
file_name: %@
\r\n
file_size: %hu"
,
@"foo"
,
d
,
v
,
@"file"
,
size
]]);
STAssertTrue
(
success
,
@"Failed to upload the correct data (using NSData)"
);
}
...
...
Please
register
or
login
to post a comment