mirror of
https://github.com/aykhans/dodo.git
synced 2025-09-03 18:03:34 +00:00
🎨 Format files
This commit is contained in:
@@ -13,12 +13,12 @@ type Body []string
|
||||
func (body Body) String() string {
|
||||
var buffer bytes.Buffer
|
||||
if len(body) == 0 {
|
||||
return string(buffer.Bytes())
|
||||
return buffer.String()
|
||||
}
|
||||
|
||||
if len(body) == 1 {
|
||||
buffer.WriteString(body[0])
|
||||
return string(buffer.Bytes())
|
||||
return buffer.String()
|
||||
}
|
||||
|
||||
buffer.WriteString(text.FgBlue.Sprint("Random") + "[\n")
|
||||
@@ -41,7 +41,7 @@ func (body Body) String() string {
|
||||
}
|
||||
|
||||
buffer.WriteString("\n]")
|
||||
return string(buffer.Bytes())
|
||||
return buffer.String()
|
||||
}
|
||||
|
||||
func (body *Body) UnmarshalJSON(b []byte) error {
|
||||
|
@@ -14,7 +14,7 @@ type Cookies []KeyValue[string, []string]
|
||||
func (cookies Cookies) String() string {
|
||||
var buffer bytes.Buffer
|
||||
if len(cookies) == 0 {
|
||||
return string(buffer.Bytes())
|
||||
return buffer.String()
|
||||
}
|
||||
|
||||
indent := " "
|
||||
@@ -53,7 +53,7 @@ func (cookies Cookies) String() string {
|
||||
buffer.WriteString(",\n" + text.FgGreen.Sprintf("+%d cookies", remainingPairs))
|
||||
}
|
||||
|
||||
return string(buffer.Bytes())
|
||||
return buffer.String()
|
||||
}
|
||||
|
||||
func (cookies *Cookies) AppendByKey(key, value string) {
|
||||
|
@@ -32,7 +32,7 @@ func (duration *Duration) UnmarshalJSON(b []byte) error {
|
||||
}
|
||||
|
||||
func (duration Duration) MarshalJSON() ([]byte, error) {
|
||||
return json.Marshal(duration.Duration.String())
|
||||
return json.Marshal(duration.String())
|
||||
}
|
||||
|
||||
func (duration *Duration) UnmarshalYAML(unmarshal func(interface{}) error) error {
|
||||
|
@@ -14,7 +14,7 @@ type Headers []KeyValue[string, []string]
|
||||
func (headers Headers) String() string {
|
||||
var buffer bytes.Buffer
|
||||
if len(headers) == 0 {
|
||||
return string(buffer.Bytes())
|
||||
return buffer.String()
|
||||
}
|
||||
|
||||
indent := " "
|
||||
@@ -53,7 +53,7 @@ func (headers Headers) String() string {
|
||||
buffer.WriteString(",\n" + text.FgGreen.Sprintf("+%d headers", remainingPairs))
|
||||
}
|
||||
|
||||
return string(buffer.Bytes())
|
||||
return buffer.String()
|
||||
}
|
||||
|
||||
func (headers *Headers) AppendByKey(key, value string) {
|
||||
|
@@ -14,7 +14,7 @@ type Params []KeyValue[string, []string]
|
||||
func (params Params) String() string {
|
||||
var buffer bytes.Buffer
|
||||
if len(params) == 0 {
|
||||
return string(buffer.Bytes())
|
||||
return buffer.String()
|
||||
}
|
||||
|
||||
indent := " "
|
||||
@@ -53,7 +53,7 @@ func (params Params) String() string {
|
||||
buffer.WriteString(",\n" + text.FgGreen.Sprintf("+%d params", remainingPairs))
|
||||
}
|
||||
|
||||
return string(buffer.Bytes())
|
||||
return buffer.String()
|
||||
}
|
||||
|
||||
func (params *Params) AppendByKey(key, value string) {
|
||||
|
@@ -14,12 +14,12 @@ type Proxies []url.URL
|
||||
func (proxies Proxies) String() string {
|
||||
var buffer bytes.Buffer
|
||||
if len(proxies) == 0 {
|
||||
return string(buffer.Bytes())
|
||||
return buffer.String()
|
||||
}
|
||||
|
||||
if len(proxies) == 1 {
|
||||
buffer.WriteString(proxies[0].String())
|
||||
return string(buffer.Bytes())
|
||||
return buffer.String()
|
||||
}
|
||||
|
||||
buffer.WriteString(text.FgBlue.Sprint("Random") + "[\n")
|
||||
@@ -42,7 +42,7 @@ func (proxies Proxies) String() string {
|
||||
}
|
||||
|
||||
buffer.WriteString("\n]")
|
||||
return string(buffer.Bytes())
|
||||
return buffer.String()
|
||||
}
|
||||
|
||||
func (proxies *Proxies) UnmarshalJSON(b []byte) error {
|
||||
|
@@ -18,7 +18,7 @@ func (requestURL *RequestURL) UnmarshalJSON(data []byte) error {
|
||||
|
||||
parsedURL, err := url.Parse(urlStr)
|
||||
if err != nil {
|
||||
return errors.New("Request URL is invalid")
|
||||
return errors.New("request URL is invalid")
|
||||
}
|
||||
|
||||
requestURL.URL = *parsedURL
|
||||
@@ -33,7 +33,7 @@ func (requestURL *RequestURL) UnmarshalYAML(unmarshal func(interface{}) error) e
|
||||
|
||||
parsedURL, err := url.Parse(urlStr)
|
||||
if err != nil {
|
||||
return errors.New("Request URL is invalid")
|
||||
return errors.New("request URL is invalid")
|
||||
}
|
||||
|
||||
requestURL.URL = *parsedURL
|
||||
|
@@ -32,7 +32,7 @@ func (timeout *Timeout) UnmarshalJSON(b []byte) error {
|
||||
}
|
||||
|
||||
func (timeout Timeout) MarshalJSON() ([]byte, error) {
|
||||
return json.Marshal(timeout.Duration.String())
|
||||
return json.Marshal(timeout.String())
|
||||
}
|
||||
|
||||
func (timeout *Timeout) UnmarshalYAML(unmarshal func(interface{}) error) error {
|
||||
|
Reference in New Issue
Block a user