-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Jianhui Zhao <zhaojh329@gmail.com>
- Loading branch information
Showing
3 changed files
with
162 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
#!/usr/bin/env eco | ||
|
||
local http = require 'eco.http.client' | ||
|
||
local form = http.form() | ||
|
||
form:add('name', 'eco') | ||
form:add('age', '123') | ||
|
||
local ok, err = form:add_file('file', 'test.bin') | ||
if not ok then | ||
error(err) | ||
end | ||
|
||
local resp, err = http.post('http://127.0.0.1:8080/upload', form) | ||
if not resp then | ||
print(err) | ||
return | ||
end | ||
|
||
print('code:', resp.code) | ||
print('status:', resp.status) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters