File tree Expand file tree Collapse file tree 1 file changed +42
-0
lines changed Expand file tree Collapse file tree 1 file changed +42
-0
lines changed Original file line number Diff line number Diff line change 1+ 'use strict' ;
2+ const common = require ( '../common' ) ;
3+ const startCLI = require ( '../common/debugger' ) ;
4+
5+ common . skipIfInspectorDisabled ( ) ;
6+
7+ const assert = require ( 'assert' ) ;
8+ const http = require ( 'http' ) ;
9+
10+ const host = '127.0.0.1' ;
11+
12+ {
13+ const server = http . createServer ( ( req , res ) => {
14+ res . statusCode = 400 ;
15+ res . end ( 'Bad Request' ) ;
16+ } ) ;
17+ server . listen ( 0 , common . mustCall ( ( ) => {
18+ const port = server . address ( ) . port ;
19+ const cli = startCLI ( [ `${ host } :${ port } ` ] ) ;
20+ cli . quit ( ) . then ( common . mustCall ( ( code ) => {
21+ assert . strictEqual ( code , 1 ) ;
22+ } ) ) . finally ( ( ) => {
23+ server . close ( ) ;
24+ } ) ;
25+ } ) ) ;
26+ }
27+
28+ {
29+ const server = http . createServer ( ( req , res ) => {
30+ res . statusCode = 200 ;
31+ res . end ( 'some data that is invalid json' ) ;
32+ } ) ;
33+ server . listen ( 0 , host , common . mustCall ( ( ) => {
34+ const port = server . address ( ) . port ;
35+ const cli = startCLI ( [ `${ host } :${ port } ` ] ) ;
36+ cli . quit ( ) . then ( common . mustCall ( ( code ) => {
37+ assert . strictEqual ( code , 1 ) ;
38+ } ) ) . finally ( ( ) => {
39+ server . close ( ) ;
40+ } ) ;
41+ } ) ) ;
42+ }
You can’t perform that action at this time.
0 commit comments