Skip to content

Commit

Permalink
Update to latest goflow and start using httpx.DetectContentType
Browse files Browse the repository at this point in the history
  • Loading branch information
rowanseymour committed Apr 12, 2022
1 parent 9682d1d commit dffc498
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 9 deletions.
2 changes: 1 addition & 1 deletion core/ivr/ivr.go
Original file line number Diff line number Diff line change
Expand Up @@ -450,7 +450,7 @@ func ResumeIVRFlow(

if body != nil {
// guess our content type and set it
contentType := http.DetectContentType(body)
contentType := httpx.DetectContentType(body)
w.Header().Set("Content-Type", contentType)
_, err := w.Write(body)
return err
Expand Down
2 changes: 1 addition & 1 deletion core/models/orgs.go
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ func (o *Org) StoreAttachment(ctx context.Context, rt *runtime.Runtime, filename
content.Close()

if contentType == "" {
contentType = http.DetectContentType(contentBytes)
contentType = httpx.DetectContentType(contentBytes)
contentType, _, _ = mime.ParseMediaType(contentType)
}

Expand Down
5 changes: 3 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ require (
github.com/kylelemons/godebug v1.1.0 // indirect
github.com/lib/pq v1.10.4
github.com/nyaruka/ezconf v0.2.1
github.com/nyaruka/gocommon v1.17.1
github.com/nyaruka/goflow v0.156.1
github.com/nyaruka/gocommon v1.18.0
github.com/nyaruka/goflow v0.157.0
github.com/nyaruka/librato v1.0.0
github.com/nyaruka/logrus_sentry v0.8.2-0.20190129182604-c2962b80ba7d
github.com/nyaruka/null v1.2.0
Expand All @@ -41,6 +41,7 @@ require (
github.com/blevesearch/segment v0.9.0 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/fatih/structs v1.0.0 // indirect
github.com/gabriel-vasile/mimetype v1.4.0 // indirect
github.com/go-mail/mail v2.3.1+incompatible // indirect
github.com/go-playground/locales v0.14.0 // indirect
github.com/go-playground/universal-translator v0.18.0 // indirect
Expand Down
11 changes: 7 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ github.com/fatih/structs v1.0.0/go.mod h1:9NiDSp5zOcgEDl+j00MP/WkGVPOlPRLejGD8Ga
github.com/fortytw2/leaktest v1.3.0 h1:u8491cBMTQ8ft8aeV+adlcytMZylmA5nnwwkRZjI8vw=
github.com/fortytw2/leaktest v1.3.0/go.mod h1:jDsjWgpAGjm2CA7WthBh/CdZYEPF31XHquHwclZch5g=
github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo=
github.com/gabriel-vasile/mimetype v1.4.0 h1:Cn9dkdYsMIu56tGho+fqzh7XmvY2YyGU0FnbhiOsEro=
github.com/gabriel-vasile/mimetype v1.4.0/go.mod h1:fA8fi6KUiG7MgQQ+mEWotXoEOvmxRtOJlERCzSmRvr8=
github.com/getsentry/raven-go v0.1.2-0.20190125112653-238ebd86338d h1:CIp8WnfXz70wJVQ0ytr3dswFYGoJbAxWgNvaLpiu3sY=
github.com/getsentry/raven-go v0.1.2-0.20190125112653-238ebd86338d/go.mod h1:KungGk8q33+aIAZUIVWZDr2OfAEBsO49PX4NzFV5kcQ=
github.com/go-chi/chi v4.1.2+incompatible h1:fGFk2Gmi/YKXk0OmGfBh0WgmN3XB8lVnEyNz34tQRec=
Expand Down Expand Up @@ -133,10 +135,10 @@ github.com/naoina/toml v0.1.1/go.mod h1:NBIhNtsFMo3G2szEBne+bO4gS192HuIYRqfvOWb4
github.com/nyaruka/ezconf v0.2.1 h1:TDXWoqjqYya1uhou1mAJZg7rgFYL98EB0Tb3+BWtUh0=
github.com/nyaruka/ezconf v0.2.1/go.mod h1:ey182kYkw2MIi4XiWe1FR/mzI33WCmTWuceDYYxgnQw=
github.com/nyaruka/gocommon v1.5.3/go.mod h1:2ZeBZF9yt20IaAJ4aC1ujojAsFhJBk2IuDvSl7KuQDw=
github.com/nyaruka/gocommon v1.17.1 h1:4bbNp+0/BIbne4VDiKOxh3kcbdvEu/WsrsZiG/VyRZ8=
github.com/nyaruka/gocommon v1.17.1/go.mod h1:nmYyb7MZDM0iW4DYJKiBzfKuE9nbnx+xSHZasuIBOT0=
github.com/nyaruka/goflow v0.156.1 h1:bRVNuuMkbbmkKsphyLI9+F57kVGBfFfu2rjLZ+0er/U=
github.com/nyaruka/goflow v0.156.1/go.mod h1:HhK+wn4aRji8qJgJR8l48hPiZxnwVDdWa0Ogy5ifnSQ=
github.com/nyaruka/gocommon v1.18.0 h1:pRSV63w449FVHrjeXJNNIyoD0k47ruqPq3fROuHBjD0=
github.com/nyaruka/gocommon v1.18.0/go.mod h1:+jVWR2FB6XTqFz7fjvVIZMFwp2B6uoaCk7NVLGnfPFM=
github.com/nyaruka/goflow v0.157.0 h1:t8ilxL1Fi38Y/fiYBTB8o+jknxeRwKprgxaXkIhjfqM=
github.com/nyaruka/goflow v0.157.0/go.mod h1:J+FJ0iw1cjivEziBGpVPtTl9fuOz+ib558MCBdKLC8M=
github.com/nyaruka/librato v1.0.0 h1:Vznj9WCeC1yZXbBYyYp40KnbmXLbEkjKmHesV/v2SR0=
github.com/nyaruka/librato v1.0.0/go.mod h1:pkRNLFhFurOz0QqBz6/DuTFhHHxAubWxs4Jx+J7yUgg=
github.com/nyaruka/logrus_sentry v0.8.2-0.20190129182604-c2962b80ba7d h1:hyp9u36KIwbTCo2JAJ+TuJcJBc+UZzEig7RI/S5Dvkc=
Expand Down Expand Up @@ -220,6 +222,7 @@ golang.org/x/net v0.0.0-20190613194153-d28f0bde5980/go.mod h1:z5CRVTTTmAJ677TzLL
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20200202094626-16171245cfb2/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20200925080053-05aa5d4ee321/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA=
golang.org/x/net v0.0.0-20210505024714-0287a6fb4125/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
golang.org/x/net v0.0.0-20210614182718-04defd469f4e h1:XpT3nA5TvE525Ne3hInMh6+GETgn27Zfm9dxsThnX2Q=
golang.org/x/net v0.0.0-20210614182718-04defd469f4e/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
Expand Down
2 changes: 1 addition & 1 deletion web/ivr/ivr.go
Original file line number Diff line number Diff line change
Expand Up @@ -362,7 +362,7 @@ func handleStatus(ctx context.Context, rt *runtime.Runtime, r *http.Request, w h
return channel, nil, provider.WriteErrorResponse(w, errors.Wrapf(err, "error while preprocessing status"))
}
if len(body) > 0 {
contentType := http.DetectContentType(body)
contentType := httpx.DetectContentType(body)
w.Header().Set("Content-Type", contentType)
_, err := w.Write(body)
return channel, nil, err
Expand Down

0 comments on commit dffc498

Please sign in to comment.