@@ -2,7 +2,7 @@ import RequestBuilder from '../../src/Backend/RequestBuilder';
22
33describe ( 'buildRequest' , ( ) => {
44 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' ) ;
66 const { url, fetchOptions } = builder . buildRequest (
77 { firstName : 'Ryan' } ,
88 [ ] ,
@@ -23,7 +23,7 @@ describe('buildRequest', () => {
2323 } ) ;
2424
2525 it ( 'sets basic data on POST request' , ( ) => {
26- const builder = new RequestBuilder ( '/_components' , 'post' , '_the_csrf_token' ) ;
26+ const builder = new RequestBuilder ( '/_components' , 'post' ) ;
2727 const { url, fetchOptions } = builder . buildRequest (
2828 { firstName : 'Ryan' } ,
2929 [
@@ -42,7 +42,6 @@ describe('buildRequest', () => {
4242 expect ( fetchOptions . method ) . toEqual ( 'POST' ) ;
4343 expect ( fetchOptions . headers ) . toEqual ( {
4444 Accept : 'application/vnd.live-component+html' ,
45- 'X-CSRF-TOKEN' : '_the_csrf_token' ,
4645 'X-Requested-With' : 'XMLHttpRequest' ,
4746 } ) ;
4847 const body = < FormData > fetchOptions . body ;
@@ -58,7 +57,7 @@ describe('buildRequest', () => {
5857 } ) ;
5958
6059 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' ) ;
6261 const { url, fetchOptions } = builder . buildRequest (
6362 { firstName : 'Ryan' } ,
6463 [
@@ -101,7 +100,7 @@ describe('buildRequest', () => {
101100
102101 // when data is too long it makes a post request
103102 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' ) ;
105104 const { url, fetchOptions } = builder . buildRequest (
106105 { firstName : 'Ryan' . repeat ( 1000 ) } ,
107106 [ ] ,
@@ -129,7 +128,7 @@ describe('buildRequest', () => {
129128 } ) ;
130129
131130 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' ) ;
133132 const { url, fetchOptions } = builder . buildRequest (
134133 {
135134 firstName : 'Ryan' ,
@@ -161,7 +160,7 @@ describe('buildRequest', () => {
161160 } ) ;
162161
163162 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' ) ;
165164 const { url } = builder . buildRequest ( { firstName : 'Ryan' } , [ ] , { firstName : 'Kevin' } , { } , { count : 5 } , { } ) ;
166165
167166 expect ( url ) . toEqual (
@@ -216,7 +215,7 @@ describe('buildRequest', () => {
216215 } ;
217216
218217 it ( 'Sends file with request' , ( ) => {
219- const builder = new RequestBuilder ( '/_components' , 'post' , '_the_csrf_token' ) ;
218+ const builder = new RequestBuilder ( '/_components' , 'post' ) ;
220219
221220 const { url, fetchOptions } = builder . buildRequest (
222221 { firstName : 'Ryan' } ,
@@ -231,7 +230,6 @@ describe('buildRequest', () => {
231230 expect ( fetchOptions . method ) . toEqual ( 'POST' ) ;
232231 expect ( fetchOptions . headers ) . toEqual ( {
233232 Accept : 'application/vnd.live-component+html' ,
234- 'X-CSRF-TOKEN' : '_the_csrf_token' ,
235233 'X-Requested-With' : 'XMLHttpRequest' ,
236234 } ) ;
237235 const body = < FormData > fetchOptions . body ;
@@ -241,7 +239,7 @@ describe('buildRequest', () => {
241239 } ) ;
242240
243241 it ( 'Sends multiple files with request' , ( ) => {
244- const builder = new RequestBuilder ( '/_components' , 'post' , '_the_csrf_token' ) ;
242+ const builder = new RequestBuilder ( '/_components' , 'post' ) ;
245243
246244 const { url, fetchOptions } = builder . buildRequest (
247245 { firstName : 'Ryan' } ,
@@ -256,7 +254,6 @@ describe('buildRequest', () => {
256254 expect ( fetchOptions . method ) . toEqual ( 'POST' ) ;
257255 expect ( fetchOptions . headers ) . toEqual ( {
258256 Accept : 'application/vnd.live-component+html' ,
259- 'X-CSRF-TOKEN' : '_the_csrf_token' ,
260257 'X-Requested-With' : 'XMLHttpRequest' ,
261258 } ) ;
262259 const body = < FormData > fetchOptions . body ;
0 commit comments