Skip to content

Commit aead9a4

Browse files
author
Omri Peleg
committed
Merge branch 'master' of https://github.com/Kong/httpsnippet into master
2 parents 31ed164 + 7da7657 commit aead9a4

File tree

302 files changed

+3857
-1510
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

302 files changed

+3857
-1510
lines changed

.jshintrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
{
22
"asi": true,
3+
"browser": true,
34
"node": true
45
}

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ node_js:
77

88
before_install:
99
- sudo apt-get update -qq
10-
- sudo apt-get install -qq --yes python3 php5-curl php5-cli
10+
- sudo apt-get install -qq php7.0 php7.0-curl php7.0-cli
1111

1212
after_script:
1313
- npm run codeclimate

Dockerfile

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# specify the node base image with your desired version node:<version>
2+
FROM node:8
3+
4+
ADD . /src
5+
WORKDIR /src
6+
7+
RUN apt-get update -qq
8+
RUN apt-get install -qq php7.0 php7.0-curl php7.0-cli
9+
RUN apt-get install -qq --yes python3

README.md

Lines changed: 37 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ snippets/
6969

7070
#### source
7171

72-
*Required*
72+
*Required*
7373
Type: `object`
7474

7575
Name of [conversion target](https://github.com/Mashape/httpsnippet/wiki/Targets)
@@ -87,7 +87,7 @@ var snippet = new HTTPSnippet({
8787

8888
#### target
8989

90-
*Required*
90+
*Required*
9191
Type: `string`
9292

9393
Name of [conversion target](https://github.com/Mashape/httpsnippet/wiki/Targets)
@@ -119,7 +119,7 @@ console.log(snippet.convert('node', {
119119

120120
#### target
121121

122-
*Required*
122+
*Required*
123123
Type: `string`
124124

125125
Name of [conversion target](https://github.com/Mashape/httpsnippet/wiki/Targets)
@@ -153,6 +153,39 @@ console.log(snippet.convert('shell', 'curl', {
153153
console.log(snippet.convert('node', 'unirest'));
154154
```
155155

156+
### addTarget(target)
157+
#### target
158+
159+
*Required*
160+
Type: `object`
161+
162+
Representation of a [conversion target](https://github.com/Kong/httpsnippet/wiki/Creating-Targets). Can use this to use targets that are not officially supported.
163+
164+
```js
165+
const customLanguageTarget = require('httpsnippet-for-my-lang');
166+
HTTPSnippet.addTarget(customLanguageTarget);
167+
```
168+
169+
### addTargetClient(target, client)
170+
### target
171+
172+
*Required*
173+
Type: `string`
174+
175+
Name of [conversion target](https://github.com/Mashape/httpsnippet/wiki/Targets)
176+
177+
### client
178+
179+
*Required*
180+
Type: `object`
181+
182+
Representation of a [conversion target client](https://github.com/Kong/httpsnippet/wiki/Creating-Targets). Can use this to use target clients that are not officially supported.
183+
184+
```js
185+
const customClient = require('httpsnippet-for-my-node-http-client');
186+
HTTPSnippet.addTargetClient('node', customClient);
187+
```
188+
156189
## Documentation
157190

158191
At the heart of this module is the [HAR Format](http://www.softwareishard.com/blog/har-12-spec/#request) as the HTTP request description format, please review some of the sample JSON HAR Request objects in [test fixtures](/test/fixtures/requests), or read the [HAR Docs](http://www.softwareishard.com/blog/har-12-spec/#request) for more details.
@@ -196,7 +229,7 @@ For more information on SemVer, please visit <http://semver.org/>.
196229
[license-url]: https://github.com/Kong/httpsnippet/blob/master/LICENSE
197230

198231
[travis-url]: https://travis-ci.org/Kong/httpsnippet
199-
[travis-image]: https://img.shields.io/travis/Kong/httpsnippet.svg?style=flat-square
232+
[travis-image]: https://api.travis-ci.org/Kong/httpsnippet.svg?branch=master
200233

201234
[npm-url]: https://www.npmjs.com/package/httpsnippet
202235
[npm-license]: https://img.shields.io/npm/l/httpsnippet.svg?style=flat-square

docker-compose.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
version: '3'
2+
services:
3+
httpsnippet:
4+
build: .
5+
command: [npm, test]

0 commit comments

Comments
 (0)