Skip to content

Commit

Permalink
Release: ✨ Gif/Avif Support and Memory leak fix [1.0.22] (#266)
Browse files Browse the repository at this point in the history
  • Loading branch information
Danny-Dasilva committed Oct 24, 2023
1 parent e933993 commit 7c054f8
Show file tree
Hide file tree
Showing 33 changed files with 1,199 additions and 6,209 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/golang.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.16
go-version: 1.17

- name: Build
working-directory: ./cycletls
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/manual_publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
strategy:
matrix:
node-version: [15.x]
go-version: [1.16]
go-version: [1.17]
steps:
- uses: actions/checkout@v2
- name: 🟢 Use Node.js ${{ matrix.node-version }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
strategy:
matrix:
node-version: [15.x]
go-version: [1.16]
go-version: [1.17]
steps:
- uses: actions/checkout@v2
- name: 🟢 Use Node.js ${{ matrix.node-version }}
Expand Down
9 changes: 7 additions & 2 deletions .github/workflows/test_golang.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ jobs:
test:
strategy:
matrix:
go-version: [1.16]
go-version: [1.17]
platform: [ubuntu-latest, macos-latest, windows-latest]
runs-on: ${{ matrix.platform }}

Expand All @@ -28,6 +28,11 @@ jobs:
working-directory: ./cycletls
run: go test --race -v ./...

- name: Start SOCKS5 Proxy (only on ubuntu)
if: matrix.platform == 'ubuntu-latest'
run: |
docker run -d -p 1087:1080 serjs/go-socks5-proxy
- name: Integration Tests
working-directory: ./cycletls
run: go test --race -v -tags=integration ./...
run: go test --race -v -tags=integration ./...
8 changes: 1 addition & 7 deletions .github/workflows/test_npm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
strategy:
matrix:
node-version: [14.x]
go-version: [1.16]
go-version: [1.17]
platform: [ubuntu-latest, macos-latest, windows-latest]
runs-on: ${{ matrix.platform }}
steps:
Expand All @@ -27,12 +27,6 @@ jobs:
uses: actions/setup-go@v2
with:
go-version: ${{ matrix.go-version }}
- name: Set module-aware mode
run: go env -w GO111MODULE=auto
working-directory: ./
- name: Install golang dependencies
run: while read l; do go get -v "$l"; done < <(go list -f '{{ join .Imports "\n" }}' ./cycletls)
shell: bash

- name: Install npm depencencies
run: npm ci
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test_npm_publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
strategy:
matrix:
node-version: [15.x]
go-version: [1.16]
go-version: [1.17]
steps:
- uses: actions/checkout@v2
- name: 🟢 Use Node.js ${{ matrix.node-version }}
Expand Down
13 changes: 11 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ Currently a WIP and in Active development. See the ![Projects](https://github.co
[![license](https://img.shields.io/github/license/Danny-Dasilva/CycleTLS.svg)](https://github.com/Danny-Dasilva/CycleTLS/blob/main/LICENSE)
[![Go Report Card](https://goreportcard.com/badge/github.com/Danny-Dasilva/CycleTLS/cycletls)](https://goreportcard.com/report/github.com/Danny-Dasilva/CycleTLS/cycletls)
[![npm version](https://img.shields.io/npm/v/cycletls.svg)](https://www.npmjs.org/package/cycletls)
<a href="https://discord.gg/gsmxMHrwhu">
<img src="https://img.shields.io/discord/1100945880888115200?logo=discord"
alt="chat on Discord"></a>
</div>

If you have a API change or feature request feel free to open an [Issue](https://github.com/Danny-Dasilva/CycleTLS/issues/new/choose)
Expand Down Expand Up @@ -52,7 +55,7 @@ Table of contents

```
node ^v14.0
golang ^v1.16x
golang ^v1.17x
```

## Installation
Expand Down Expand Up @@ -317,7 +320,13 @@ const promises = [];
If you would like to compile CycleTLS on your own, use the following commands:
install npm packages
Set module-aware mode
`go env -w GO111MODULE=off`
Install golang dependencies
`go get github.com/Danny-Dasilva/CycleTLS/cycletls`
install npm packages (this command handles the above)
`npm install`
Expand Down
24 changes: 8 additions & 16 deletions cycletls/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,28 +37,20 @@ func clientBuilder(browser browser, dialer proxy.ContextDialer, timeout int, dis

// newClient creates a new http client
func newClient(browser browser, timeout int, disableRedirect bool, UserAgent string, proxyURL ...string) (http.Client, error) {
//fix check PR
var dialer proxy.ContextDialer
// Check if a valid proxyURL is provided.
if len(proxyURL) > 0 && len(proxyURL[0]) > 0 {
dialer, err := newConnectDialer(proxyURL[0], UserAgent)
var err error
dialer, err = newConnectDialer(proxyURL[0], UserAgent)
if err != nil {
return http.Client{
Timeout: time.Duration(timeout) * time.Second,
CheckRedirect: disabledRedirect, //fix this fallthrough issue (test for incorrect proxy)
CheckRedirect: disabledRedirect,
}, err
}
return clientBuilder(
browser,
dialer,
timeout,
disableRedirect,
), nil
} else {
dialer = proxy.Direct
}

return clientBuilder(
browser,
proxy.Direct,
timeout,
disableRedirect,
), nil

return clientBuilder(browser, dialer, timeout, disableRedirect), nil
}
2 changes: 1 addition & 1 deletion cycletls/connect.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ func newConnectDialer(proxyURLStr string, UserAgent string) (proxy.ContextDialer
}
dialSocksProxy, err := proxy.SOCKS5("tcp", proxyURL.Host, auth, nil)
if err != nil {
return nil, errors.New(fmt.Sprintf("Error creating SOCKS5 proxy, reason %s", err))
return nil, fmt.Errorf("Error creating SOCKS5 proxy, reason %s", err)
}
if contextDialer, ok := dialSocksProxy.(proxy.ContextDialer); ok {
client.Dialer = contextDialer
Expand Down
2 changes: 1 addition & 1 deletion cycletls/cookie.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ type data struct {
// HTTP response or the Cookie header of an HTTP request.
//
// See https://tools.ietf.org/html/rfc6265 for details.
//Stolen from Net/http/cookies
// Stolen from Net/http/cookies
type Cookie struct {
Name string `json:"name"`
Value string `json:"value"`
Expand Down
6 changes: 2 additions & 4 deletions cycletls/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,7 @@ require (
github.com/Danny-Dasilva/fhttp v0.0.0-20220524230104-f801520157d6
github.com/Danny-Dasilva/utls v0.0.0-20220604023528-30cb107b834e
github.com/PuerkitoBio/goquery v1.8.0
github.com/andybalholm/brotli v1.0.4
github.com/andybalholm/brotli v1.0.6
github.com/gorilla/websocket v1.5.0
golang.org/x/crypto v0.0.0-20220525230936-793ad666bf5e // indirect
golang.org/x/net v0.0.0-20220615171555-694bf12d69de
golang.org/x/sys v0.0.0-20220615213510-4f61da869c0c // indirect
golang.org/x/net v0.17.0
)
44 changes: 35 additions & 9 deletions cycletls/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ github.com/Danny-Dasilva/utls v0.0.0-20220604023528-30cb107b834e h1:tqiguW0yAcIw
github.com/Danny-Dasilva/utls v0.0.0-20220604023528-30cb107b834e/go.mod h1:ssfbVNUfWJVRfW41RTpedOUlGXSq3J6aLmirUVkDgJk=
github.com/PuerkitoBio/goquery v1.8.0 h1:PJTF7AmFCFKk1N6V6jmKfrNH9tV5pNE6lZMkG0gta/U=
github.com/PuerkitoBio/goquery v1.8.0/go.mod h1:ypIiRMtY7COPGk+I/YbZLbxsxn9g5ejnI2HSMtkjZvI=
github.com/andybalholm/brotli v1.0.4 h1:V7DdXeJtZscaqfNuAdSRuRFzuiKlHSC/Zh3zl9qY3JY=
github.com/andybalholm/brotli v1.0.4/go.mod h1:fO7iG3H7G2nSZ7m0zPUDn85XEX2GTukHGRSepvi9Eig=
github.com/andybalholm/brotli v1.0.6 h1:Yf9fFpf49Zrxb9NlQaluyE92/+X7UVHlhMNJN2sxfOI=
github.com/andybalholm/brotli v1.0.6/go.mod h1:fO7iG3H7G2nSZ7m0zPUDn85XEX2GTukHGRSepvi9Eig=
github.com/andybalholm/cascadia v1.3.1 h1:nhxRkql1kdYCc8Snf7D5/D3spOX+dBgjA6u8x004T2c=
github.com/andybalholm/cascadia v1.3.1/go.mod h1:R4bJ1UQfqADjvDa4P6HZHLh/3OxWWEqc0Sk8XGwHqvA=
github.com/dsnet/compress v0.0.1 h1:PlZu0n3Tuv04TzpfPbrnI0HW/YwodEXDS+oPKahKF0Q=
Expand All @@ -19,20 +19,32 @@ github.com/gorilla/websocket v1.5.0/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/ad
github.com/klauspost/compress v1.4.1/go.mod h1:RyIbtBH6LamlWaDj8nUwkbUhJ87Yi3uG0guNDohfE1A=
github.com/klauspost/cpuid v1.2.0/go.mod h1:Pj4uuM528wm8OyEC2QMXAi2YiTZ96dNQPGgoMS4s3ek=
github.com/ulikunitz/xz v0.5.6/go.mod h1:2bypXElzHzzJZwzH67Y6wb67pO62Rzfn7BSiF4ABRW8=
github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY=
gitlab.com/yawning/bsaes.git v0.0.0-20190805113838-0a714cd429ec/go.mod h1:BZ1RAoRPbCxum9Grlv5aeksu2H8BiKehBYooU2LFiOQ=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/crypto v0.0.0-20190325154230-a5d413f7728c/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
golang.org/x/crypto v0.0.0-20220411220226-7b82a4e95df4/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4=
golang.org/x/crypto v0.0.0-20220518034528-6f7dac969898/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4=
golang.org/x/crypto v0.0.0-20220525230936-793ad666bf5e h1:T8NU3HyQ8ClP4SEE+KbFlg6n0NhuTsN4MyznaarGsZM=
golang.org/x/crypto v0.0.0-20220525230936-793ad666bf5e/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4=
golang.org/x/crypto v0.14.0 h1:wBqGXzWJW6m1XrIKlAH0Hs1JJ7+9KBwnIO8v66Q9cHc=
golang.org/x/crypto v0.14.0/go.mod h1:MVFd36DqK4CsrnJYDkBA3VC4m2GkXAM0PvzMCn4JQf4=
golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4=
golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs=
golang.org/x/net v0.0.0-20190328230028-74de082e2cca/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
golang.org/x/net v0.0.0-20210610132358-84b48f89b13b/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
golang.org/x/net v0.0.0-20210916014120-12bc252f5db8/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
golang.org/x/net v0.0.0-20220412020605-290c469a71a5/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk=
golang.org/x/net v0.0.0-20220615171555-694bf12d69de h1:ogOG2+P6LjO2j55AkRScrkB2BFpd+Z8TY2wcM0Z3MGo=
golang.org/x/net v0.0.0-20220615171555-694bf12d69de/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c=
golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c=
golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs=
golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg=
golang.org/x/net v0.17.0 h1:pVaXccu2ozPjCXewfr1S7xza/zcXTity9cCdXQYSjIM=
golang.org/x/net v0.17.0/go.mod h1:NxSsAGuq816PNPmqtQdLE42eU2Fs7NoRIZrHJAlaCOE=
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190804053845-51ab0e2deafa/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
Expand All @@ -41,13 +53,27 @@ golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBc
golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220412211240-33da011f77ad/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220615213510-4f61da869c0c h1:aFV+BgZ4svzjfabn8ERpuB4JI4N6/rdy1iusx77G3oU=
golang.org/x/sys v0.0.0-20220615213510-4f61da869c0c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.13.0 h1:Af8nKPmuFypiUBjVoU9V20FiaFXOcuZI21p0ycVYYGE=
golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/term v0.0.0-20210615171337-6886f2dfbf5b/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k=
golang.org/x/term v0.8.0/go.mod h1:xPskH00ivmX89bAKVGSKKtLOWNx2+17Eiy94tnKShWo=
golang.org/x/term v0.13.0/go.mod h1:LTmsnFJwVN6bCy1rVCoS+qHT1HhALEFxKncY3WNNh4U=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.7 h1:olpwvP2KacW1ZWvsR7uQhoyTYvKAupfQrRGBFM352Gk=
golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8=
golang.org/x/text v0.13.0 h1:ablQoSUd0tRdKxZewP80B+BaqeKJuVhuRxj/dkrun3k=
golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE=
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc=
golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU=
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
4 changes: 3 additions & 1 deletion cycletls/index.go
Original file line number Diff line number Diff line change
Expand Up @@ -143,11 +143,12 @@ func processRequest(request cycleTLSRequest) (result fullRequest) {
}

}
headeOrder := parseUserAgent(request.Options.UserAgent).HeaderOrder

//ordering the pseudo headers and our normal headers
req.Header = http.Header{
http.HeaderOrderKey: headerorderkey,
http.PHeaderOrderKey: {":method", ":authority", ":scheme", ":path"},
http.PHeaderOrderKey: headeOrder,
}
//set our Host header
u, err := url.Parse(request.Options.URL)
Expand Down Expand Up @@ -325,6 +326,7 @@ var upgrader = websocket.Upgrader{
WriteBufferSize: 1024,
}

// WSEndpoint exports the main cycletls function as we websocket connection that clients can connect to
func WSEndpoint(w nhttp.ResponseWriter, r *nhttp.Request) {
upgrader.CheckOrigin = func(r *nhttp.Request) bool { return true }

Expand Down
2 changes: 1 addition & 1 deletion cycletls/roundtripper.go
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ func (rt *roundTripper) dialTLS(ctx context.Context, network, addr string) (net.
// of ALPN.
switch conn.ConnectionState().NegotiatedProtocol {
case http2.NextProtoTLS:
parsedUserAgent := parseUserAgent(rt.UserAgent)
parsedUserAgent := parseUserAgent(rt.UserAgent).UserAgent
t2 := http2.Transport{DialTLS: rt.dialTLSHTTP2,
PushHandler: &http2.DefaultPushHandler{},
Navigator: parsedUserAgent,
Expand Down
22 changes: 22 additions & 0 deletions cycletls/tests/integration/images_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -139,4 +139,26 @@ func TestFileWriting(t *testing.T) {
if filesEqual != true {
t.Fatal("Files are not equal", "webp")
}

//gif
resp = GetRequest("https://upload.wikimedia.org/wikipedia/commons/b/b1/Loading_icon.gif", client)
if resp.Status != 200 {
t.Fatalf("Expected %d Got %d for Status", 200, resp.Status)
}
WriteFile(resp.Body, "../../../tests/images/source.gif")
filesEqual = CompareFiles("../../../tests/images/test.gif", "../../../tests/images/source.gif")
if filesEqual != true {
t.Fatal("Files are not equal", "gif")
}

//webp
resp = GetRequest("https://images.unsplash.com/photo-1608481337062-4093bf3ed404", client)
if resp.Status != 200 {
t.Fatalf("Expected %d Got %d for Status", 200, resp.Status)
}
WriteFile(resp.Body, "../../../tests/images/source.avif")
filesEqual = CompareFiles("../../../tests/images/test.avif", "../../../tests/images/source.avif")
if filesEqual != true {
t.Fatal("Files are not equal", "avif")
}
}
Loading

0 comments on commit 7c054f8

Please sign in to comment.