@@ -2,7 +2,7 @@ import RequestBuilder from '../../src/Backend/RequestBuilder';
2
2
3
3
describe ( 'buildRequest' , ( ) => {
4
4
it ( 'sets basic data on GET request' , ( ) => {
5
- const builder = new RequestBuilder ( '/_components?existing_param=1' , 'get' , '_the_csrf_token' ) ;
5
+ const builder = new RequestBuilder ( '/_components?existing_param=1' , 'get' ) ;
6
6
const { url, fetchOptions } = builder . buildRequest (
7
7
{ firstName : 'Ryan' } ,
8
8
[ ] ,
@@ -23,7 +23,7 @@ describe('buildRequest', () => {
23
23
} ) ;
24
24
25
25
it ( 'sets basic data on POST request' , ( ) => {
26
- const builder = new RequestBuilder ( '/_components' , 'post' , '_the_csrf_token' ) ;
26
+ const builder = new RequestBuilder ( '/_components' , 'post' ) ;
27
27
const { url, fetchOptions } = builder . buildRequest (
28
28
{ firstName : 'Ryan' } ,
29
29
[
@@ -42,7 +42,6 @@ describe('buildRequest', () => {
42
42
expect ( fetchOptions . method ) . toEqual ( 'POST' ) ;
43
43
expect ( fetchOptions . headers ) . toEqual ( {
44
44
Accept : 'application/vnd.live-component+html' ,
45
- 'X-CSRF-TOKEN' : '_the_csrf_token' ,
46
45
'X-Requested-With' : 'XMLHttpRequest' ,
47
46
} ) ;
48
47
const body = < FormData > fetchOptions . body ;
@@ -58,7 +57,7 @@ describe('buildRequest', () => {
58
57
} ) ;
59
58
60
59
it ( 'sets basic data on POST request with batch actions' , ( ) => {
61
- const builder = new RequestBuilder ( '/_components' , 'post' , '_the_csrf_token' ) ;
60
+ const builder = new RequestBuilder ( '/_components' , 'post' ) ;
62
61
const { url, fetchOptions } = builder . buildRequest (
63
62
{ firstName : 'Ryan' } ,
64
63
[
@@ -101,7 +100,7 @@ describe('buildRequest', () => {
101
100
102
101
// when data is too long it makes a post request
103
102
it ( 'makes a POST request when data is too long' , ( ) => {
104
- const builder = new RequestBuilder ( '/_components' , 'get' , '_the_csrf_token' ) ;
103
+ const builder = new RequestBuilder ( '/_components' , 'get' ) ;
105
104
const { url, fetchOptions } = builder . buildRequest (
106
105
{ firstName : 'Ryan' . repeat ( 1000 ) } ,
107
106
[ ] ,
@@ -129,7 +128,7 @@ describe('buildRequest', () => {
129
128
} ) ;
130
129
131
130
it ( 'makes a POST request when method is post' , ( ) => {
132
- const builder = new RequestBuilder ( '/_components' , 'post' , '_the_csrf_token' ) ;
131
+ const builder = new RequestBuilder ( '/_components' , 'post' ) ;
133
132
const { url, fetchOptions } = builder . buildRequest (
134
133
{
135
134
firstName : 'Ryan' ,
@@ -161,7 +160,7 @@ describe('buildRequest', () => {
161
160
} ) ;
162
161
163
162
it ( 'sends propsFromParent when specified' , ( ) => {
164
- const builder = new RequestBuilder ( '/_components?existing_param=1' , 'get' , '_the_csrf_token' ) ;
163
+ const builder = new RequestBuilder ( '/_components?existing_param=1' , 'get' ) ;
165
164
const { url } = builder . buildRequest ( { firstName : 'Ryan' } , [ ] , { firstName : 'Kevin' } , { } , { count : 5 } , { } ) ;
166
165
167
166
expect ( url ) . toEqual (
@@ -216,7 +215,7 @@ describe('buildRequest', () => {
216
215
} ;
217
216
218
217
it ( 'Sends file with request' , ( ) => {
219
- const builder = new RequestBuilder ( '/_components' , 'post' , '_the_csrf_token' ) ;
218
+ const builder = new RequestBuilder ( '/_components' , 'post' ) ;
220
219
221
220
const { url, fetchOptions } = builder . buildRequest (
222
221
{ firstName : 'Ryan' } ,
@@ -231,7 +230,6 @@ describe('buildRequest', () => {
231
230
expect ( fetchOptions . method ) . toEqual ( 'POST' ) ;
232
231
expect ( fetchOptions . headers ) . toEqual ( {
233
232
Accept : 'application/vnd.live-component+html' ,
234
- 'X-CSRF-TOKEN' : '_the_csrf_token' ,
235
233
'X-Requested-With' : 'XMLHttpRequest' ,
236
234
} ) ;
237
235
const body = < FormData > fetchOptions . body ;
@@ -241,7 +239,7 @@ describe('buildRequest', () => {
241
239
} ) ;
242
240
243
241
it ( 'Sends multiple files with request' , ( ) => {
244
- const builder = new RequestBuilder ( '/_components' , 'post' , '_the_csrf_token' ) ;
242
+ const builder = new RequestBuilder ( '/_components' , 'post' ) ;
245
243
246
244
const { url, fetchOptions } = builder . buildRequest (
247
245
{ firstName : 'Ryan' } ,
@@ -256,7 +254,6 @@ describe('buildRequest', () => {
256
254
expect ( fetchOptions . method ) . toEqual ( 'POST' ) ;
257
255
expect ( fetchOptions . headers ) . toEqual ( {
258
256
Accept : 'application/vnd.live-component+html' ,
259
- 'X-CSRF-TOKEN' : '_the_csrf_token' ,
260
257
'X-Requested-With' : 'XMLHttpRequest' ,
261
258
} ) ;
262
259
const body = < FormData > fetchOptions . body ;
0 commit comments