diff --git a/LICENSE b/LICENSE index a0d0e5b..ff84bbf 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2018 茂名聚合科技有限公司 +Copyright (c) 2018 李光春 Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/README.md b/README.md index 36b4e58..270caab 100644 --- a/README.md +++ b/README.md @@ -2,24 +2,26 @@ Golang Request -📦 Golang 请求组件 +📦 Golang 请求 [comment]: <> (go) -[![godoc](https://pkg.go.dev/badge/go.dtapp.net/gorequest?status.svg)](https://pkg.go.dev/go.dtapp.net/gorequest) -[![goproxy.cn](https://goproxy.cn/stats/go.dtapp.net/gorequest/badges/download-count.svg)](https://goproxy.cn/stats/go.dtapp.net/gorequest) -[![goreportcard.com](https://goreportcard.com/badge/go.dtapp.net/gorequest)](https://goreportcard.com/report/go.dtapp.net/gorequest) -[![deps.dev](https://img.shields.io/badge/deps-go-red.svg)](https://deps.dev/go/go.dtapp.net/gorequest) +[![godoc](https://pkg.go.dev/badge/github.com/dtapps/gorequest?status.svg)](https://pkg.go.dev/github.com/dtapps/gorequest) +[![goproxy.cn](https://goproxy.cn/stats/github.com/dtapps/gorequest/badges/download-count.svg)](https://goproxy.cn/stats/github.com/dtapps/gorequest) +[![goreportcard.com](https://goreportcard.com/badge/github.com/dtapps/gorequest)](https://goreportcard.com/report/github.com/dtapps/gorequest) +[![deps.dev](https://img.shields.io/badge/deps-go-red.svg)](https://deps.dev/go/github.com%2Fdtapps%2Fgorequest) -#### 安装使用 +#### 安装 ```go -go get -v -u go.dtapp.net/gorequest +go get -v -u github.com/dtapps/gorequest ``` -#### 导入 +#### 使用 ```go -import ( - "go.dtapp.net/gorequest" -) +package main + +func main() { + +} ``` \ No newline at end of file diff --git a/const.go b/const.go new file mode 100644 index 0000000..8cf10a6 --- /dev/null +++ b/const.go @@ -0,0 +1,12 @@ +package gorequest + +const ( + userAgentFormat = "%s/GO/%s" +) + +// 定义请求类型 +var ( + httpParamsModeJson = "JSON" + httpParamsModeXml = "XML" + httpParamsModeForm = "FORM" +) diff --git a/go.mod b/go.mod index a6635d0..d4060a9 100644 --- a/go.mod +++ b/go.mod @@ -1,8 +1,7 @@ -module go.dtapp.net/gorequest +module github.com/dtapps/gorequest go 1.18 -require ( - go.dtapp.net/gostring v1.0.3 - go.dtapp.net/gotime v1.0.2 -) +require go.dtapp.net/gostring v1.0.3 + +require github.com/dtapps/gotime v1.0.3 diff --git a/go.sum b/go.sum index 8f30858..b7dcc97 100644 --- a/go.sum +++ b/go.sum @@ -1,4 +1,4 @@ +github.com/dtapps/gotime v1.0.3 h1:yzknDbqEOqntn3fbE2T9HRY5d03B81iIUkYKESuE8TY= +github.com/dtapps/gotime v1.0.3/go.mod h1:lbp8pG/8aV3O+t7IuAjasL2WLBsZqLZG6Uw6KqSnox8= go.dtapp.net/gostring v1.0.3 h1:KSOq4D77/g5yZN/bqWfZ0kOOaPr/P1240vg03+XdENI= go.dtapp.net/gostring v1.0.3/go.mod h1:+ggrOvgQDQturi1QGsXEpyRN/ZPoRDaqhMujIk5lrgQ= -go.dtapp.net/gotime v1.0.2 h1:CFIJHQXC/4t9bsJhk2cLhjHd6rpdPcJXr8BcHKHDuQo= -go.dtapp.net/gotime v1.0.2/go.mod h1:Gq7eNLr2iMLP18UNWONRq4V3Uhf/ADp4bIrS+Tc6ktY= diff --git a/http.go b/http.go index 096b655..f8c1910 100644 --- a/http.go +++ b/http.go @@ -6,7 +6,7 @@ import ( "encoding/json" "errors" "fmt" - "go.dtapp.net/gotime" + "github.com/dtapps/gotime" "io" "io/ioutil" "net/http" @@ -16,8 +16,6 @@ import ( "time" ) -var userAgentFormat = "DtApp-Request/%s (%s) GO/%s" - // Response 返回内容 type Response struct { RequestUri string //【请求】链接 @@ -47,13 +45,6 @@ type App struct { p12Cert *tls.Certificate // p12证书内容 } -// 定义 -var ( - httpParamsModeJson = "JSON" - httpParamsModeXml = "XML" - httpParamsModeForm = "FORM" -) - // NewHttp 实例化 func NewHttp() *App { return &App{ @@ -199,7 +190,7 @@ func request(app *App) (httpResponse Response, err error) { } } - httpResponse.RequestHeader.Set("Sdk-User-Agent", fmt.Sprintf(userAgentFormat, Version, runtime.GOOS, runtime.Version())) + httpResponse.RequestHeader.Set("Sdk-User-Agent", fmt.Sprintf(userAgentFormat, runtime.GOOS, runtime.Version())) switch app.httpContentType { case httpParamsModeJson: httpResponse.RequestHeader.Set("Content-Type", "application/json") diff --git a/xml.go b/params_xml.go similarity index 100% rename from xml.go rename to params_xml.go diff --git a/version.go b/version.go index 414cff8..80fb410 100644 --- a/version.go +++ b/version.go @@ -1,3 +1,3 @@ package gorequest -const Version = "1.0.20" +const Version = "1.0.21"