File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -28,6 +28,9 @@ currently the following output [targets](/src/targets) are supported:
2828- [ HTTPie] ( http://httpie.org )
2929- Node.js
3030 - [ Native] ( http://nodejs.org/api/http.html#http_http_request_options_callback )
31+ - [ Request] ( https://github.com/request/request )
32+ - OCaml
33+ - [ CoHTTP] ( https://github.com/mirage/ocaml-cohttp )
3134- PHP
3235 - [ ext-curl] ( http://php.net/manual/en/book.curl.php )
3336- [ Wget] ( https://www.gnu.org/software/wget/ )
Original file line number Diff line number Diff line change @@ -108,7 +108,15 @@ var HTTPSnippet = function (req, lang) {
108108 case 'application/json' :
109109 case 'application/x-json' :
110110 if ( this . source . postData . text ) {
111- this . source . postData . jsonObj = JSON . parse ( this . source . postData . text ) ;
111+ try {
112+ this . source . postData . jsonObj = JSON . parse ( this . source . postData . text ) ;
113+ } catch ( e ) {
114+ debug ( e ) ;
115+
116+ // force back to text/plain
117+ // if headers have proper content-type value, then this should also work
118+ this . source . postData . mimeType = 'text/plain'
119+ }
112120 }
113121 break ;
114122 }
Original file line number Diff line number Diff line change @@ -64,7 +64,7 @@ module.exports = function (source, options) {
6464
6565module . exports . info = {
6666 key : 'cohttp' ,
67- title : 'OCaml ' ,
67+ title : 'CoHTTP ' ,
6868 link : 'https://github.com/mirage/ocaml-cohttp' ,
6969 description : 'Cohttp is a very lightweight HTTP server using Lwt or Async for OCaml'
7070} ;
You can’t perform that action at this time.
0 commit comments