Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
R
request-proxy
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Jira
Jira
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ui
request-proxy
Commits
3948b207
Commit
3948b207
authored
Jan 30, 2018
by
liuwei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改 支持put
parent
86e30abe
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
10 deletions
+10
-10
index.js
index.js
+10
-10
No files found.
index.js
View file @
3948b207
...
@@ -62,7 +62,7 @@ module.exports = function (options) {
...
@@ -62,7 +62,7 @@ module.exports = function (options) {
ctx
.
req
.
connection
.
setNoDelay
(
true
)
ctx
.
req
.
connection
.
setNoDelay
(
true
)
ctx
.
curl
=
function
(
option
,
extra
)
{
ctx
.
curl
=
function
(
option
,
extra
)
{
if
(
typeof
option
===
'
string
'
)
{
if
(
typeof
option
===
'
string
'
)
{
option
=
{
uri
:
option
}
option
=
{
uri
:
option
}
}
}
if
(
!
option
.
method
)
{
if
(
!
option
.
method
)
{
...
@@ -85,7 +85,7 @@ module.exports = function (options) {
...
@@ -85,7 +85,7 @@ module.exports = function (options) {
}
}
return
new
Promise
(
function
(
resolve
,
reject
)
{
return
new
Promise
(
function
(
resolve
,
reject
)
{
request
(
option
,
function
(
err
,
response
,
body
)
{
request
(
option
,
function
(
err
,
response
,
body
)
{
if
(
err
)
{
if
(
err
)
{
if
(
extra
.
throw
)
{
if
(
extra
.
throw
)
{
reject
(
err
)
reject
(
err
)
...
@@ -105,7 +105,7 @@ module.exports = function (options) {
...
@@ -105,7 +105,7 @@ module.exports = function (options) {
ctx
.
pipe
=
function
(
option
)
{
ctx
.
pipe
=
function
(
option
)
{
if
(
typeof
option
===
'
string
'
)
{
if
(
typeof
option
===
'
string
'
)
{
option
=
{
uri
:
option
}
option
=
{
uri
:
option
}
}
}
option
=
Object
.
assign
({},
pipeDefault
,
option
)
option
=
Object
.
assign
({},
pipeDefault
,
option
)
...
@@ -131,7 +131,7 @@ module.exports = function (options) {
...
@@ -131,7 +131,7 @@ module.exports = function (options) {
})
})
}
}
if
(
ctx
.
method
===
'
POST
'
&&
ctx
.
is
(
'
json
'
,
'
urlencoded
'
)
&&
ctx
.
request
.
body
)
{
if
(
ctx
.
is
(
'
json
'
,
'
urlencoded
'
)
&&
ctx
.
request
.
body
)
{
if
(
ctx
.
is
(
'
urlencoded
'
))
{
if
(
ctx
.
is
(
'
urlencoded
'
))
{
option
.
form
=
ctx
.
request
.
rawBody
option
.
form
=
ctx
.
request
.
rawBody
}
else
{
}
else
{
...
@@ -145,9 +145,9 @@ module.exports = function (options) {
...
@@ -145,9 +145,9 @@ module.exports = function (options) {
return
new
Promise
(
function
(
resolve
,
reject
)
{
return
new
Promise
(
function
(
resolve
,
reject
)
{
let
r
=
send
()
let
r
=
send
()
r
.
on
(
'
error
'
,
function
(
err
)
{
r
.
on
(
'
error
'
,
function
(
err
)
{
console
.
error
(
err
)
console
.
error
(
err
)
reject
(
err
);
reject
(
err
);
})
})
.
on
(
'
response
'
,
function
()
{
.
on
(
'
response
'
,
function
()
{
ctx
.
respond
=
false
ctx
.
respond
=
false
r
.
pipe
(
ctx
.
res
)
r
.
pipe
(
ctx
.
res
)
...
@@ -160,9 +160,9 @@ module.exports = function (options) {
...
@@ -160,9 +160,9 @@ module.exports = function (options) {
return
new
Promise
(
function
(
resolve
,
reject
)
{
return
new
Promise
(
function
(
resolve
,
reject
)
{
let
r
=
ctx
.
req
.
pipe
(
send
())
let
r
=
ctx
.
req
.
pipe
(
send
())
r
.
on
(
'
error
'
,
function
(
err
)
{
r
.
on
(
'
error
'
,
function
(
err
)
{
console
.
error
(
err
)
console
.
error
(
err
)
reject
(
err
);
reject
(
err
);
})
})
.
on
(
'
response
'
,
function
()
{
.
on
(
'
response
'
,
function
()
{
ctx
.
respond
=
false
ctx
.
respond
=
false
r
.
pipe
(
ctx
.
res
)
r
.
pipe
(
ctx
.
res
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment