forked from postmanlabs/httpsnippet-fsless
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwget.js
More file actions
48 lines (38 loc) · 1.7 KB
/
wget.js
File metadata and controls
48 lines (38 loc) · 1.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
/* global it */
'use strict'
require('should')
module.exports = function (HTTPSnippet, fixtures) {
it('should use short options', function () {
var result = new HTTPSnippet(fixtures.requests.full).convert('shell', 'wget', {
short: true,
indent: false
})
result.should.be.a.String
result.should.eql("wget -q --method POST --header 'cookie: foo=bar; bar=baz' --header 'accept: application/json' --header 'content-type: application/x-www-form-urlencoded' --body-data foo=bar -O - 'http://mockbin.com/har?foo=bar&foo=baz&baz=abc&key=value'")
})
it('should ask for -v output', function () {
var result = new HTTPSnippet(fixtures.requests.short).convert('shell', 'wget', {
short: true,
indent: false,
verbose: true
})
result.should.be.a.String
result.should.eql('wget -v --method GET -O - http://mockbin.com/har')
})
it('should ask for --verbose output', function () {
var result = new HTTPSnippet(fixtures.requests.short).convert('shell', 'wget', {
short: false,
indent: false,
verbose: true
})
result.should.be.a.String
result.should.eql('wget --verbose --method GET --output-document - http://mockbin.com/har')
})
it('should use custom indentation', function () {
var result = new HTTPSnippet(fixtures.requests.full).convert('shell', 'wget', {
indent: '@'
})
result.should.be.a.String
result.replace(/\\\n/g, '').should.eql("wget --quiet @--method POST @--header 'cookie: foo=bar; bar=baz' @--header 'accept: application/json' @--header 'content-type: application/x-www-form-urlencoded' @--body-data foo=bar @--output-document @- 'http://mockbin.com/har?foo=bar&foo=baz&baz=abc&key=value'")
})
}