Update requests dependency

This commit is contained in:
Jan-Lukas Else 2022-01-04 09:48:37 +01:00
parent db6c54f3bf
commit d6518c3a5d
6 changed files with 11 additions and 10 deletions

2
go.mod
View File

@ -11,7 +11,7 @@ require (
github.com/alecthomas/chroma v0.9.4
github.com/araddon/dateparse v0.0.0-20210429162001-6b43995a97de
github.com/c2h5oh/datasize v0.0.0-20200825124411-48ed595a09d2
github.com/carlmjohnson/requests v0.21.13
github.com/carlmjohnson/requests v0.22.1
github.com/cretz/bine v0.2.0
github.com/dchest/captcha v0.0.0-20200903113550-03f5f0333e1f
github.com/dgraph-io/ristretto v0.1.0

4
go.sum
View File

@ -65,8 +65,8 @@ github.com/boombuler/barcode v1.0.1-0.20190219062509-6c824513bacc h1:biVzkmvwrH8
github.com/boombuler/barcode v1.0.1-0.20190219062509-6c824513bacc/go.mod h1:paBWMcWSl3LHKBqUq+rly7CNSldXjb2rDl3JlRe0mD8=
github.com/c2h5oh/datasize v0.0.0-20200825124411-48ed595a09d2 h1:t8KYCwSKsOEZBFELI4Pn/phbp38iJ1RRAkDFNin1aak=
github.com/c2h5oh/datasize v0.0.0-20200825124411-48ed595a09d2/go.mod h1:S/7n9copUssQ56c7aAgHqftWO4LTf4xY6CGWt8Bc+3M=
github.com/carlmjohnson/requests v0.21.13 h1:p9DiBwbrLG8uA67YPOrfGMG1ZRzRyPBaO9hXQpX+Ork=
github.com/carlmjohnson/requests v0.21.13/go.mod h1:Hw4fFOk3xDlHQbNRTGo4oc52TUTpVEq93sNy/H+mrQM=
github.com/carlmjohnson/requests v0.22.1 h1:YoifpEbpJW4LPRX/+0dJe3vTLducEE9Ib10k6lElIUM=
github.com/carlmjohnson/requests v0.22.1/go.mod h1:Hw4fFOk3xDlHQbNRTGo4oc52TUTpVEq93sNy/H+mrQM=
github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU=
github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs=
github.com/cespare/xxhash/v2 v2.1.2 h1:YRXhKfTDauu4ajMg1TPgFO5jnlC2HCbmLXMcTG5cbYE=

View File

@ -63,7 +63,7 @@ func (sp *shortpixel) compress(url string, upload mediaStorageSaveFunc, hc *http
err := requests.
URL("https://api.shortpixel.com/v2/reducer-sync.php").
Client(hc).
Post().
Method(http.MethodPost).
BodyJSON(map[string]interface{}{
"key": sp.key,
"plugin_version": "GB001",
@ -100,7 +100,7 @@ func (tf *tinify) compress(url string, upload mediaStorageSaveFunc, hc *http.Cli
err := requests.
URL("https://api.tinify.com/shrink").
Client(hc).
Post().
Method(http.MethodPost).
BasicAuth("api", tf.key).
BodyJSON(map[string]interface{}{
"source": map[string]interface{}{
@ -124,7 +124,7 @@ func (tf *tinify) compress(url string, upload mediaStorageSaveFunc, hc *http.Cli
err = requests.
URL(compressedLocation).
Client(hc).
Post().
Method(http.MethodPost).
BasicAuth("api", tf.key).
BodyJSON(map[string]interface{}{
"resize": map[string]interface{}{
@ -157,7 +157,6 @@ func (cf *cloudflare) compress(url string, upload mediaStorageSaveFunc, hc *http
err := requests.
URL(fmt.Sprintf("https://www.cloudflare.com/cdn-cgi/image/f=jpeg,q=75,metadata=none,fit=scale-down,w=%d,h=%d/%s", defaultCompressionWidth, defaultCompressionHeight, url)).
Client(hc).
Get().
ToBytesBuffer(&imgBuffer).
Fetch(context.Background())
if err != nil {

View File

@ -2,6 +2,7 @@ package main
import (
"context"
"net/http"
"strings"
"github.com/carlmjohnson/requests"
@ -22,7 +23,7 @@ func (a *goBlog) sendNtfy(cfg *configNtfy, msg string) error {
URL(cfg.Topic).
Client(a.httpClient).
UserAgent(appUserAgent).
Post().
Method(http.MethodPost).
BodyReader(strings.NewReader(msg)).
Fetch(context.Background())
}

3
tts.go
View File

@ -8,6 +8,7 @@ import (
"html"
"io"
"log"
"net/http"
"net/url"
"path"
"strings"
@ -177,7 +178,7 @@ func (a *goBlog) createTTSAudio(lang, ssml string, w io.Writer) error {
Param("key", gctts.GoogleAPIKey).
Client(a.httpClient).
UserAgent(appUserAgent).
Post().
Method(http.MethodPost).
BodyJSON(body).
ToJSON(&response).
Fetch(context.Background())

View File

@ -73,7 +73,7 @@ func (a *goBlog) sendWebmentions(p *post) error {
func (a *goBlog) sendWebmention(endpoint, source, target string) error {
// TODO: Pass all tests from https://webmention.rocks/
return requests.URL(endpoint).Client(a.httpClient).Post().UserAgent(appUserAgent).
return requests.URL(endpoint).Client(a.httpClient).Method(http.MethodPost).UserAgent(appUserAgent).
BodyForm(url.Values{
"source": []string{source},
"target": []string{target},