File tree Expand file tree Collapse file tree 3 files changed +13
-2
lines changed
Expand file tree Collapse file tree 3 files changed +13
-2
lines changed Original file line number Diff line number Diff line change @@ -29,6 +29,9 @@ currently the following output [targets](/src/targets) are supported:
2929- [ HTTPie] ( http://httpie.org )
3030- Node.js
3131 - [ Native] ( http://nodejs.org/api/http.html#http_http_request_options_callback )
32+ - [ Request] ( https://github.com/request/request )
33+ - OCaml
34+ - [ CoHTTP] ( https://github.com/mirage/ocaml-cohttp )
3235- PHP
3336 - [ ext-curl] ( http://php.net/manual/en/book.curl.php )
3437- [ Wget] ( https://www.gnu.org/software/wget/ )
Original file line number Diff line number Diff line change @@ -49,7 +49,15 @@ var HTTPSnippet = function (req, lang) {
4949
5050 case 'application/json' :
5151 if ( this . source . postData . text ) {
52- this . source . postData . jsonObj = JSON . parse ( this . source . postData . text ) ;
52+ try {
53+ this . source . postData . jsonObj = JSON . parse ( this . source . postData . text ) ;
54+ } catch ( e ) {
55+ debug ( e ) ;
56+
57+ // force back to text/plain
58+ // if headers have proper content-type value, then this should also work
59+ this . source . postData . mimeType = 'text/plain'
60+ }
5361 }
5462 break ;
5563 }
Original file line number Diff line number Diff line change @@ -75,7 +75,7 @@ module.exports = function (options) {
7575
7676module . exports . info = {
7777 key : 'cohttp' ,
78- title : 'OCaml ' ,
78+ title : 'CoHTTP ' ,
7979 link : 'https://github.com/mirage/ocaml-cohttp' ,
8080 description : 'Cohttp is a very lightweight HTTP server using Lwt or Async for OCaml'
8181} ;
You can’t perform that action at this time.
0 commit comments