Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 0 additions & 12 deletions src/app/core/xsrf/xsrf-fallback.interceptor.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,18 +45,6 @@ describe('XsrfFallbackInterceptor', () => {
httpMock.verify()
})

it('passes through without adding header when production is true', () => {
const env = (window as any).runtimeEnvironment
env.production = true
cookieGetSpy.and.returnValue('xsrf-token-123')

http.post(apiBase + 'works/work.json', {}).subscribe()

const req = httpMock.expectOne(apiBase + 'works/work.json')
expect(req.request.headers.has('x-xsrf-token')).toBe(false)
req.flush({})
env.production = false
})

it('passes through GET requests without adding header', () => {
http.get(apiBase + 'works/works.json').subscribe()
Expand Down
7 changes: 0 additions & 7 deletions src/app/core/xsrf/xsrf-fallback.interceptor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@ declare const runtimeEnvironment: any
* support (configured via withXsrfConfiguration) does not attach the header,
* especially when using the local proxy setup.
*
* Only active when not in production (local development runs).
*
* Behaviour:
* - For mutating backend calls (POST/PUT/PATCH/DELETE) to ORCID web APIs:
* - If an XSRF header is already present, do nothing.
Expand All @@ -34,11 +32,6 @@ export class XsrfFallbackInterceptor implements HttpInterceptor {
req: HttpRequest<any>,
next: HttpHandler
): Observable<HttpEvent<any>> {
// Only apply fallback in local development (e.g. proxy / same-origin dev)
if (runtimeEnvironment.production) {
return next.handle(req)
}

const method = (req.method ?? '').toUpperCase()

// Only care about mutating requests
Expand Down
Loading