Compare commits

..

5 Commits

Author SHA1 Message Date
ca6b3d4eb2
Merge pull request #64 from aykhans/bump/version
🔖 Bump version to 0.5.501
2024-12-25 02:08:59 +04:00
1ee06aacc3
🔖 Bump version to 0.5.501 2024-12-25 02:08:47 +04:00
3d5834a6a6
Merge pull request #63 from aykhans/fix/empty-slice
🐛 Return empty brackets instead of null when slice length is 0
2024-12-25 01:24:28 +04:00
f1521cbb74
💄 Update config table 2024-12-23 18:58:22 +04:00
40f8a1cc37 🐛 Return empty brackets instead of null when slice length is 0 2024-12-22 23:15:10 +04:00
2 changed files with 5 additions and 2 deletions

View File

@ -12,7 +12,7 @@ import (
) )
const ( const (
VERSION string = "0.5.5" VERSION string = "0.5.501"
DefaultUserAgent string = "Dodo/" + VERSION DefaultUserAgent string = "Dodo/" + VERSION
ProxyCheckURL string = "https://www.google.com" ProxyCheckURL string = "https://www.google.com"
DefaultMethod string = "GET" DefaultMethod string = "GET"
@ -79,7 +79,7 @@ func (config *RequestConfig) Print() {
t.AppendSeparator() t.AppendSeparator()
t.AppendRow(table.Row{"Cookies", string(utils.PrettyJSONMarshal(config.Cookies, 3, "", " "))}) t.AppendRow(table.Row{"Cookies", string(utils.PrettyJSONMarshal(config.Cookies, 3, "", " "))})
t.AppendSeparator() t.AppendSeparator()
t.AppendRow(table.Row{"Proxies Count", string(utils.PrettyJSONMarshal(config.Proxies, 3, "", " "))}) t.AppendRow(table.Row{"Proxies", string(utils.PrettyJSONMarshal(config.Proxies, 3, "", " "))})
t.AppendSeparator() t.AppendSeparator()
t.AppendRow(table.Row{"Proxy Check", !config.NoProxyCheck}) t.AppendRow(table.Row{"Proxy Check", !config.NoProxyCheck})
t.AppendSeparator() t.AppendSeparator()

View File

@ -17,6 +17,9 @@ func (t TruncatedMarshaller) MarshalJSON() ([]byte, error) {
if val.Kind() != reflect.Slice && val.Kind() != reflect.Array { if val.Kind() != reflect.Slice && val.Kind() != reflect.Array {
return json.Marshal(t.Value) return json.Marshal(t.Value)
} }
if val.Len() == 0 {
return []byte("[]"), nil
}
length := val.Len() length := val.Len()
if length <= t.MaxItems { if length <= t.MaxItems {