This repository was archived by the owner on May 22, 2019. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +24
-2
lines changed
Expand file tree Collapse file tree 1 file changed +24
-2
lines changed Original file line number Diff line number Diff line change 11const extend = require ( 'node.extend' ) ;
2+ const querystring = require ( 'querystring' ) ;
23
34const viewports = process . env . PA11Y_VIEWPORTS || [
45 {
@@ -76,10 +77,10 @@ smoke.forEach((smokeConfig) => {
7677 url : process . env . TEST_URL + url
7778 }
7879
80+ thisUrl . page = { } ;
81+
7982 // Do we have test-specific headers?
8083 if ( smokeConfig . headers ) {
81- thisUrl . page = { } ;
82-
8384 let fullCookie ;
8485 let fullFlags ;
8586
@@ -108,6 +109,27 @@ smoke.forEach((smokeConfig) => {
108109 }
109110 }
110111
112+ thisUrl . page . settings = { } ;
113+
114+ if ( smokeConfig . method ) thisUrl . page . settings . operation = smokeConfig . method ;
115+
116+ if ( smokeConfig . body ) {
117+
118+ thisUrl . page . settings . data = ( contentType => {
119+ switch ( contentType ) {
120+ case 'application/x-www-form-urlencoded' :
121+ return querystring . stringify ( smokeConfig . body ) ;
122+ case 'application/json' :
123+ return JSON . stringify ( smokeConfig . body ) ;
124+ default :
125+ return smokeConfig . body ;
126+ }
127+ } ) ( smokeConfig . headers [ 'Content-Type' ] ) ;
128+
129+ thisUrl . page . settings . encoding = 'utf8' ;
130+
131+ }
132+
111133 urls . push ( thisUrl ) ;
112134 }
113135} ) ;
You can’t perform that action at this time.
0 commit comments