Skip to content

Commit

Permalink
Merge pull request #72 from wjdp/feature/http-ua
Browse files Browse the repository at this point in the history
Set HTTP User-Agent
  • Loading branch information
wjdp authored Jan 28, 2018
2 parents 26f20eb + 45f720a commit 59e5286
Show file tree
Hide file tree
Showing 36 changed files with 166,492 additions and 212 deletions.
5 changes: 4 additions & 1 deletion htmltest/check-link.go
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,10 @@ func (hT *HTMLTest) checkExternal(ref *htmldoc.Reference) {
// to panic if err != nil.
output.CheckErrorPanic(err)

// Set headers
// Set UA header
req.Header.Set("User-Agent", "htmltest/" + hT.opts.Version)

// Set headers from HTTPHeaders option
for key, value := range hT.opts.HTTPHeaders {
// Due to the way we're loading in config these keys and values are interface{}. In normal cases they are
// strings, but could very easily be ints (side note: this isn't great, we'll fix this later, #73)
Expand Down
3,165 changes: 3,164 additions & 1 deletion htmltest/fixtures/vcr/generic/citeBroken.html.cassette

Large diffs are not rendered by default.

3,248 changes: 3,247 additions & 1 deletion htmltest/fixtures/vcr/generic/citeValid.html.cassette

Large diffs are not rendered by default.

172 changes: 172 additions & 0 deletions htmltest/fixtures/vcr/generic/videoBroken.html.cassette
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,178 @@
},
"ErrType": "*net.OpError",
"ErrMsg": "dial tcp: lookup swowkopskpok.com on 127.0.1.1:53: no such host"
},
{
"Request": {
"Method": "GET",
"URL": {
"Scheme": "http",
"Opaque": "",
"User": null,
"Host": "nope.yyz",
"Path": "/vid.mp4",
"RawPath": "",
"ForceQuery": false,
"RawQuery": "",
"Fragment": ""
},
"Header": {
"Accept": [
"*/*"
],
"Range": [
"bytes=0-0"
],
"User-Agent": [
"htmltest/"
]
},
"Body": ""
},
"Response": {
"Status": "",
"StatusCode": 0,
"Proto": "",
"ProtoMajor": 0,
"ProtoMinor": 0,
"Header": null,
"Body": null,
"ContentLength": 0,
"TransferEncoding": null,
"Trailer": null,
"TLS": null
},
"ErrType": "*net.OpError",
"ErrMsg": "dial tcp: lookup nope.yyz on 127.0.1.1:53: no such host"
},
{
"Request": {
"Method": "GET",
"URL": {
"Scheme": "https",
"Opaque": "",
"User": null,
"Host": "swowkopskpok.com",
"Path": "/xyz.ogg",
"RawPath": "",
"ForceQuery": false,
"RawQuery": "",
"Fragment": ""
},
"Header": {
"Accept": [
"*/*"
],
"Range": [
"bytes=0-0"
],
"User-Agent": [
"htmltest/"
]
},
"Body": ""
},
"Response": {
"Status": "",
"StatusCode": 0,
"Proto": "",
"ProtoMajor": 0,
"ProtoMinor": 0,
"Header": null,
"Body": null,
"ContentLength": 0,
"TransferEncoding": null,
"Trailer": null,
"TLS": null
},
"ErrType": "*net.OpError",
"ErrMsg": "dial tcp: lookup swowkopskpok.com on 127.0.1.1:53: no such host"
},
{
"Request": {
"Method": "GET",
"URL": {
"Scheme": "http",
"Opaque": "",
"User": null,
"Host": "nope.yyz",
"Path": "/vid.mp4",
"RawPath": "",
"ForceQuery": false,
"RawQuery": "",
"Fragment": ""
},
"Header": {
"Accept": [
"*/*"
],
"Range": [
"bytes=0-0"
],
"User-Agent": [
"htmltest/dev"
]
},
"Body": ""
},
"Response": {
"Status": "",
"StatusCode": 0,
"Proto": "",
"ProtoMajor": 0,
"ProtoMinor": 0,
"Header": null,
"Body": null,
"ContentLength": 0,
"TransferEncoding": null,
"Trailer": null,
"TLS": null
},
"ErrType": "*net.OpError",
"ErrMsg": "dial tcp: lookup nope.yyz on 127.0.1.1:53: no such host"
},
{
"Request": {
"Method": "GET",
"URL": {
"Scheme": "https",
"Opaque": "",
"User": null,
"Host": "swowkopskpok.com",
"Path": "/xyz.ogg",
"RawPath": "",
"ForceQuery": false,
"RawQuery": "",
"Fragment": ""
},
"Header": {
"Accept": [
"*/*"
],
"Range": [
"bytes=0-0"
],
"User-Agent": [
"htmltest/dev"
]
},
"Body": ""
},
"Response": {
"Status": "",
"StatusCode": 0,
"Proto": "",
"ProtoMajor": 0,
"ProtoMinor": 0,
"Header": null,
"Body": null,
"ContentLength": 0,
"TransferEncoding": null,
"Trailer": null,
"TLS": null
},
"ErrType": "*net.OpError",
"ErrMsg": "dial tcp: lookup swowkopskpok.com on 127.0.1.1:53: no such host"
}
]
}
Loading

0 comments on commit 59e5286

Please sign in to comment.