@@ -7,44 +7,44 @@ describe('methodOverride(getter)', function () {
77 it ( 'should not touch the method by default' , function ( done ) {
88 var server = createServer ( )
99 request ( server )
10- . get ( '/' )
11- . expect ( 'X-Got-Method' , 'GET' , done )
10+ . get ( '/' )
11+ . expect ( 'X-Got-Method' , 'GET' , done )
1212 } )
1313
1414 it ( 'should use X-HTTP-Method-Override by default' , function ( done ) {
1515 var server = createServer ( )
1616 request ( server )
17- . post ( '/' )
18- . set ( 'X-HTTP-Method-Override' , 'DELETE' )
19- . expect ( 'X-Got-Method' , 'DELETE' , done )
17+ . post ( '/' )
18+ . set ( 'X-HTTP-Method-Override' , 'DELETE' )
19+ . expect ( 'X-Got-Method' , 'DELETE' , done )
2020 } )
2121
2222 describe ( 'with query' , function ( ) {
2323 it ( 'should work missing query' , function ( done ) {
2424 var server = createServer ( '_method' )
2525
2626 request ( server )
27- . post ( '/' )
28- . set ( 'Content-Type' , 'application/json' )
29- . expect ( 'X-Got-Method' , 'POST' , done )
27+ . post ( '/' )
28+ . set ( 'Content-Type' , 'application/json' )
29+ . expect ( 'X-Got-Method' , 'POST' , done )
3030 } )
3131
3232 it ( 'should be case in-sensitive' , function ( done ) {
3333 var server = createServer ( '_method' )
3434
3535 request ( server )
36- . post ( '/?_method=DELete' )
37- . set ( 'Content-Type' , 'application/json' )
38- . expect ( 'X-Got-Method' , 'DELETE' , done )
36+ . post ( '/?_method=DELete' )
37+ . set ( 'Content-Type' , 'application/json' )
38+ . expect ( 'X-Got-Method' , 'DELETE' , done )
3939 } )
4040
4141 it ( 'should ignore invalid methods' , function ( done ) {
4242 var server = createServer ( '_method' )
4343
4444 request ( server )
45- . post ( '/?_method=BOGUS' )
46- . set ( 'Content-Type' , 'application/json' )
47- . expect ( 'X-Got-Method' , 'POST' , done )
45+ . post ( '/?_method=BOGUS' )
46+ . set ( 'Content-Type' , 'application/json' )
47+ . expect ( 'X-Got-Method' , 'POST' , done )
4848 } )
4949
5050 it ( 'should handle key referencing array' , function ( done ) {
@@ -60,9 +60,9 @@ describe('methodOverride(getter)', function () {
6060 var server = createServer ( '_method' )
6161
6262 request ( server )
63- . delete ( '/?_method=PATCH' )
64- . set ( 'Content-Type' , 'application/json' )
65- . expect ( 'X-Got-Method' , 'DELETE' , done )
63+ . delete ( '/?_method=PATCH' )
64+ . set ( 'Content-Type' , 'application/json' )
65+ . expect ( 'X-Got-Method' , 'DELETE' , done )
6666 } )
6767 } )
6868
@@ -74,50 +74,50 @@ describe('methodOverride(getter)', function () {
7474
7575 it ( 'should work missing header' , function ( done ) {
7676 request ( server )
77- . post ( '/' )
78- . set ( 'Content-Type' , 'application/json' )
79- . expect ( 'X-Got-Method' , 'POST' , done )
77+ . post ( '/' )
78+ . set ( 'Content-Type' , 'application/json' )
79+ . expect ( 'X-Got-Method' , 'POST' , done )
8080 } )
8181
8282 it ( 'should be case in-sensitive' , function ( done ) {
8383 request ( server )
84- . post ( '/' )
85- . set ( 'Content-Type' , 'application/json' )
86- . set ( 'X-HTTP-Method-Override' , 'DELete' )
87- . expect ( 'X-Got-Method' , 'DELETE' , done )
84+ . post ( '/' )
85+ . set ( 'Content-Type' , 'application/json' )
86+ . set ( 'X-HTTP-Method-Override' , 'DELete' )
87+ . expect ( 'X-Got-Method' , 'DELETE' , done )
8888 } )
8989
9090 it ( 'should ignore invalid methods' , function ( done ) {
9191 request ( server )
92- . post ( '/' )
93- . set ( 'Content-Type' , 'application/json' )
94- . set ( 'X-HTTP-Method-Override' , 'BOGUS' )
95- . expect ( 'X-Got-Method' , 'POST' , done )
92+ . post ( '/' )
93+ . set ( 'Content-Type' , 'application/json' )
94+ . set ( 'X-HTTP-Method-Override' , 'BOGUS' )
95+ . expect ( 'X-Got-Method' , 'POST' , done )
9696 } )
9797
9898 it ( 'should handle multiple headers' , function ( done ) {
9999 request ( server )
100- . post ( '/' )
101- . set ( 'Content-Type' , 'application/json' )
102- . set ( 'X-HTTP-Method-Override' , 'DELETE, PUT' )
103- . expect ( 'X-Got-Method' , 'DELETE' , done )
100+ . post ( '/' )
101+ . set ( 'Content-Type' , 'application/json' )
102+ . set ( 'X-HTTP-Method-Override' , 'DELETE, PUT' )
103+ . expect ( 'X-Got-Method' , 'DELETE' , done )
104104 } )
105105
106106 it ( 'should set Vary header' , function ( done ) {
107107 request ( server )
108- . post ( '/' )
109- . set ( 'Content-Type' , 'application/json' )
110- . set ( 'X-HTTP-Method-Override' , 'DELETE' )
111- . expect ( 'Vary' , 'X-HTTP-Method-Override' )
112- . expect ( 'X-Got-Method' , 'DELETE' , done )
108+ . post ( '/' )
109+ . set ( 'Content-Type' , 'application/json' )
110+ . set ( 'X-HTTP-Method-Override' , 'DELETE' )
111+ . expect ( 'Vary' , 'X-HTTP-Method-Override' )
112+ . expect ( 'X-Got-Method' , 'DELETE' , done )
113113 } )
114114
115115 it ( 'should set Vary header even with no override' , function ( done ) {
116116 request ( server )
117- . post ( '/' )
118- . set ( 'Content-Type' , 'application/json' )
119- . expect ( 'Vary' , 'X-HTTP-Method-Override' )
120- . expect ( 'X-Got-Method' , 'POST' , done )
117+ . post ( '/' )
118+ . set ( 'Content-Type' , 'application/json' )
119+ . expect ( 'Vary' , 'X-HTTP-Method-Override' )
120+ . expect ( 'X-Got-Method' , 'POST' , done )
121121 } )
122122 } )
123123
@@ -131,53 +131,53 @@ describe('methodOverride(getter)', function () {
131131
132132 it ( 'should work missing header' , function ( done ) {
133133 request ( server )
134- . post ( '/' )
135- . set ( 'Content-Type' , 'application/json' )
136- . expect ( 'X-Got-Method' , 'PATCH' , done )
134+ . post ( '/' )
135+ . set ( 'Content-Type' , 'application/json' )
136+ . expect ( 'X-Got-Method' , 'PATCH' , done )
137137 } )
138138
139139 it ( 'should be case in-sensitive' , function ( done ) {
140140 request ( server )
141- . post ( '/' )
142- . set ( 'Content-Type' , 'application/json' )
143- . set ( 'X-Method-Override' , 'DELete' )
144- . expect ( 'X-Got-Method' , 'DELETE' , done )
141+ . post ( '/' )
142+ . set ( 'Content-Type' , 'application/json' )
143+ . set ( 'X-Method-Override' , 'DELete' )
144+ . expect ( 'X-Got-Method' , 'DELETE' , done )
145145 } )
146146
147147 it ( 'should ignore invalid methods' , function ( done ) {
148148 request ( server )
149- . post ( '/' )
150- . set ( 'Content-Type' , 'application/json' )
151- . set ( 'X-Method-Override' , 'BOGUS' )
152- . expect ( 'X-Got-Method' , 'POST' , done )
149+ . post ( '/' )
150+ . set ( 'Content-Type' , 'application/json' )
151+ . set ( 'X-Method-Override' , 'BOGUS' )
152+ . expect ( 'X-Got-Method' , 'POST' , done )
153153 } )
154154 } )
155155
156156 describe ( 'given "options.methods"' , function ( ) {
157157 it ( 'should allow other methods' , function ( done ) {
158158 var server = createServer ( 'X-HTTP-Method-Override' , { methods : [ 'POST' , 'PATCH' ] } )
159159 request ( server )
160- . patch ( '/' )
161- . set ( 'Content-Type' , 'application/json' )
162- . set ( 'X-HTTP-Method-Override' , 'DELETE' )
163- . expect ( 'X-Got-Method' , 'DELETE' , done )
160+ . patch ( '/' )
161+ . set ( 'Content-Type' , 'application/json' )
162+ . set ( 'X-HTTP-Method-Override' , 'DELETE' )
163+ . expect ( 'X-Got-Method' , 'DELETE' , done )
164164 } )
165165
166166 it ( 'should allow all methods' , function ( done ) {
167167 var server = createServer ( 'X-HTTP-Method-Override' , { methods : null } )
168168 request ( server )
169- . patch ( '/' )
170- . set ( 'Content-Type' , 'application/json' )
171- . set ( 'X-HTTP-Method-Override' , 'DELETE' )
172- . expect ( 'X-Got-Method' , 'DELETE' , done )
169+ . patch ( '/' )
170+ . set ( 'Content-Type' , 'application/json' )
171+ . set ( 'X-HTTP-Method-Override' , 'DELETE' )
172+ . expect ( 'X-Got-Method' , 'DELETE' , done )
173173 } )
174174
175175 it ( 'should not call getter when method not allowed' , function ( done ) {
176176 var server = createServer ( function ( req ) { return 'DELETE' } )
177177 request ( server )
178- . patch ( '/' )
179- . set ( 'Content-Type' , 'application/json' )
180- . expect ( 'X-Got-Method' , 'PATCH' , done )
178+ . patch ( '/' )
179+ . set ( 'Content-Type' , 'application/json' )
180+ . expect ( 'X-Got-Method' , 'PATCH' , done )
181181 } )
182182 } )
183183} )
0 commit comments