Skip to content

Commit b7818e6

Browse files
committed
Adding some docs on the new target and client APIs to the readme.
1 parent 02ef6fa commit b7818e6

File tree

1 file changed

+36
-3
lines changed

1 file changed

+36
-3
lines changed

README.md

Lines changed: 36 additions & 3 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.

0 commit comments

Comments
 (0)