Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
U
ulfssar-go
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Faizal Aziz
ulfssar-go
Commits
08372808
Commit
08372808
authored
Jun 20, 2024
by
Administrator
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update client.go
parent
3f8fd14e
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
4 deletions
+11
-4
client.go
pkg/http-client/client.go
+11
-4
No files found.
pkg/http-client/client.go
View file @
08372808
...
...
@@ -46,7 +46,7 @@ type (
Post
(
ctx
*
context
.
UlfsaarContext
,
path
string
,
headers
http
.
Header
,
payload
interface
{})
(
respHeader
http
.
Header
,
statusCode
int
,
body
[]
byte
,
err
error
)
PostFormData
(
ctx
*
context
.
UlfsaarContext
,
path
string
,
headers
http
.
Header
,
payload
map
[
string
]
string
)
(
respHeader
http
.
Header
,
statusCode
int
,
body
[]
byte
,
err
error
)
PostFormDataWithProxy
(
ctx
*
context
.
UlfsaarContext
,
path
,
ip
,
port
,
username
,
password
string
,
headers
http
.
Header
,
payload
map
[
string
]
string
)
(
respHeader
http
.
Header
,
statusCode
int
,
body
[]
byte
,
err
error
)
PostMultipartFormFilesAndData
(
ctx
*
context
.
UlfsaarContext
,
path
string
,
headers
http
.
Header
,
formData
[]
*
MultipartField
,
formFiles
[]
MultipartFileRequest
)
(
respHeader
http
.
Header
,
statusCode
int
,
body
[]
byte
,
err
error
)
PostMultipartFormFilesAndData
(
ctx
*
context
.
UlfsaarContext
,
path
string
,
headers
http
.
Header
,
formData
[]
*
MultipartField
,
formFiles
[]
MultipartFileRequest
,
proxyUrl
*
string
)
(
respHeader
http
.
Header
,
statusCode
int
,
body
[]
byte
,
err
error
)
PostWithProxy
(
ctx
*
context
.
UlfsaarContext
,
path
,
ip
,
port
,
username
,
password
string
,
headers
http
.
Header
,
payload
interface
{})
(
respHeader
http
.
Header
,
statusCode
int
,
body
[]
byte
,
err
error
)
Put
(
ctx
*
context
.
UlfsaarContext
,
path
string
,
headers
http
.
Header
,
payload
interface
{})
(
respHeader
http
.
Header
,
statusCode
int
,
body
[]
byte
,
err
error
)
Get
(
ctx
*
context
.
UlfsaarContext
,
path
string
,
headers
http
.
Header
)
(
respHeader
http
.
Header
,
statusCode
int
,
body
[]
byte
,
err
error
)
...
...
@@ -189,7 +189,7 @@ func (c *client) PostWithProxy(ctx *context.UlfsaarContext, uri, ip, port, usern
logger
.
ToField
(
processingTimeKey
,
processingTime
(
startTime
)),
)
if
statusCode
==
http
.
StatusOK
{
if
statusCode
/
http
.
StatusOK
==
1
{
return
respHeader
,
statusCode
,
body
,
nil
}
...
...
@@ -317,11 +317,18 @@ func (c *client) PostFormData(ctx *context.UlfsaarContext, url string, headers h
return
respHeader
,
statusCode
,
body
,
httpErr
}
func
(
c
*
client
)
PostMultipartFormFilesAndData
(
ctx
*
context
.
UlfsaarContext
,
url
string
,
headers
http
.
Header
,
formData
[]
*
MultipartField
,
formFiles
[]
MultipartFileRequest
)
(
respHeader
http
.
Header
,
statusCode
int
,
body
[]
byte
,
err
error
)
{
func
(
c
*
client
)
PostMultipartFormFilesAndData
(
ctx
*
context
.
UlfsaarContext
,
url
string
,
headers
http
.
Header
,
formData
[]
*
MultipartField
,
formFiles
[]
MultipartFileRequest
,
proxyUrl
*
string
)
(
respHeader
http
.
Header
,
statusCode
int
,
body
[]
byte
,
err
error
)
{
//url := c.options.Address + path
startTime
:=
time
.
Now
()
request
:=
c
.
httpClient
.
R
()
var
request
*
resty
.
Request
if
proxyUrl
!=
nil
&&
*
proxyUrl
!=
""
{
request
=
c
.
httpClient
.
SetProxy
(
*
proxyUrl
)
.
R
()
}
else
{
request
=
c
.
httpClient
.
RemoveProxy
()
.
R
()
}
request
.
SetMultipartFields
(
formData
...
)
for
_
,
val
:=
range
formFiles
{
...
...
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