Skip to content
Snippets Groups Projects
Commit b8d0fe38 authored by OZGCloud's avatar OZGCloud
Browse files

Merge pull request 'OZG-2574-Weisse-Seite-Header-only' (#180) from...

Merge pull request 'OZG-2574-Weisse-Seite-Header-only' (#180) from OZG-2574-Weisse-Seite-Header-only into master

Reviewed-on: https://git.ozg-sh.de/mgm/goofy/pulls/180
parents 9509ce33 2cf4c87b
Branches
Tags
No related merge requests found
......@@ -378,7 +378,8 @@
"serve": {
"builder": "@angular-devkit/build-angular:dev-server",
"options": {
"browserTarget": "goofy:build"
"browserTarget": "goofy:build",
"proxyConfig": "proxy.conf.mjs"
},
"configurations": {
"production": {
......
......@@ -23,3 +23,4 @@
*/
export * from './lib/environment.module';
export * from './lib/environment.service';
/*
* Copyright (C) 2022 Das Land Schleswig-Holstein vertreten durch den
* Ministerpräsidenten des Landes Schleswig-Holstein
* Staatskanzlei
* Abteilung Digitalisierung und zentrales IT-Management der Landesregierung
*
* Lizenziert unter der EUPL, Version 1.2 oder - sobald
* diese von der Europäischen Kommission genehmigt wurden -
* Folgeversionen der EUPL ("Lizenz");
* Sie dürfen dieses Werk ausschließlich gemäß
* dieser Lizenz nutzen.
* Eine Kopie der Lizenz finden Sie hier:
*
* https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
*
* Sofern nicht durch anwendbare Rechtsvorschriften
* gefordert oder in schriftlicher Form vereinbart, wird
* die unter der Lizenz verbreitete Software "so wie sie
* ist", OHNE JEGLICHE GEWÄHRLEISTUNG ODER BEDINGUNGEN -
* ausdrücklich oder stillschweigend - verbreitet.
* Die sprachspezifischen Genehmigungen und Beschränkungen
* unter der Lizenz sind dem Lizenztext zu entnehmen.
*/
import { HttpRequest } from '@angular/common/http';
import { faker } from '@faker-js/faker';
import { HttpMethod } from '../tech.model';
import { XhrInterceptor } from './xhr.interceptor';
describe('XhrInterceptor', () => {
let interceptor: XhrInterceptor;
const url: string = faker.internet.url();
beforeEach(() => {
interceptor = new XhrInterceptor();
})
it('should be created', () => {
expect(interceptor).toBeTruthy();
});
describe('addHeader', () => {
it('should add X-Requested-With header', () => {
const request: HttpRequest<unknown> = new HttpRequest(HttpMethod.GET, url);
const result: HttpRequest<unknown> = interceptor.addHeader(request);
expect(result.headers.get('X-Requested-With')).toEqual('XMLHttpRequest');
})
})
});
\ No newline at end of file
/*
* Copyright (C) 2022 Das Land Schleswig-Holstein vertreten durch den
* Ministerpräsidenten des Landes Schleswig-Holstein
* Staatskanzlei
* Abteilung Digitalisierung und zentrales IT-Management der Landesregierung
*
* Lizenziert unter der EUPL, Version 1.2 oder - sobald
* diese von der Europäischen Kommission genehmigt wurden -
* Folgeversionen der EUPL ("Lizenz");
* Sie dürfen dieses Werk ausschließlich gemäß
* dieser Lizenz nutzen.
* Eine Kopie der Lizenz finden Sie hier:
*
* https://joinup.ec.europa.eu/collection/eupl/eupl-text-eupl-12
*
* Sofern nicht durch anwendbare Rechtsvorschriften
* gefordert oder in schriftlicher Form vereinbart, wird
* die unter der Lizenz verbreitete Software "so wie sie
* ist", OHNE JEGLICHE GEWÄHRLEISTUNG ODER BEDINGUNGEN -
* ausdrücklich oder stillschweigend - verbreitet.
* Die sprachspezifischen Genehmigungen und Beschränkungen
* unter der Lizenz sind dem Lizenztext zu entnehmen.
*/
import { HttpEvent, HttpHandler, HttpInterceptor, HttpRequest } from '@angular/common/http';
import { Injectable } from '@angular/core';
import { Observable } from 'rxjs';
@Injectable()
export class XhrInterceptor implements HttpInterceptor {
intercept(req: HttpRequest<unknown>, next: HttpHandler): Observable<HttpEvent<unknown>> {
return next.handle(this.addHeader(req));
}
addHeader(req: HttpRequest<unknown>): HttpRequest<unknown> {
return req.clone({
headers: req.headers.set('X-Requested-With', 'XMLHttpRequest')
});
}
}
\ No newline at end of file
......@@ -26,6 +26,7 @@ import { HTTP_INTERCEPTORS } from '@angular/common/http';
import { Injector, NgModule } from '@angular/core';
import { HttpBinaryFileInterceptor } from './interceptor/http-binary-file.interceptor';
import { HttpXsrfInterceptor } from './interceptor/http-xsrf.interceptor';
import { XhrInterceptor } from './interceptor/xhr.interceptor';
import { ConvertForDataTestPipe } from './pipe/convert-for-data-test.pipe';
import { EnumToLabelPipe } from './pipe/enum-to-label.pipe';
import { FileSizePipe } from './pipe/file-size.pipe';
......@@ -67,6 +68,11 @@ import { ToTrafficLightPipe } from './pipe/to-traffic-light.pipe';
FileSizePipe,
],
providers: [
{
provide: HTTP_INTERCEPTORS,
useClass: XhrInterceptor,
multi: true,
},
{
provide: HTTP_INTERCEPTORS,
useClass: HttpXsrfInterceptor,
......
......@@ -29,20 +29,20 @@ import {
DateFnsAdapter,
MatDateFnsModule
} from '@angular/material-date-fns-adapter';
import { MatLegacyAutocompleteModule as MatAutocompleteModule } from '@angular/material/legacy-autocomplete';
import { MatBadgeModule } from '@angular/material/badge';
import { MatLegacyButtonModule as MatButtonModule } from '@angular/material/legacy-button';
import { MatLegacyCheckboxModule as MatCheckboxModule } from '@angular/material/legacy-checkbox';
import {
DateAdapter,
MatRippleModule,
MAT_DATE_LOCALE
} from '@angular/material/core';
import { MatDatepickerModule } from '@angular/material/datepicker';
import { MatLegacyDialogModule as MatDialogModule } from '@angular/material/legacy-dialog';
import { MatExpansionModule } from '@angular/material/expansion';
import { MatLegacyFormFieldModule as MatFormFieldModule } from '@angular/material/legacy-form-field';
import { MatIconModule } from '@angular/material/icon';
import { MatLegacyAutocompleteModule as MatAutocompleteModule } from '@angular/material/legacy-autocomplete';
import { MatLegacyButtonModule as MatButtonModule } from '@angular/material/legacy-button';
import { MatLegacyCheckboxModule as MatCheckboxModule } from '@angular/material/legacy-checkbox';
import { MatLegacyDialogModule as MatDialogModule } from '@angular/material/legacy-dialog';
import { MatLegacyFormFieldModule as MatFormFieldModule } from '@angular/material/legacy-form-field';
import { MatLegacyInputModule as MatInputModule } from '@angular/material/legacy-input';
import { MatLegacyListModule as MatListModule } from '@angular/material/legacy-list';
import { MatLegacyMenuModule as MatMenuModule } from '@angular/material/legacy-menu';
......
......@@ -4,8 +4,8 @@
"license": "MIT",
"scripts": {
"postinstall": "node ./decorate-angular-cli.js && ngcc --properties es2020 browser module main --first-only --create-ivy-entry-points",
"start": "nx serve --port 4300 --disable-host-check --proxy-config proxy.conf.json --verbose",
"start-for-screenreader": "nx serve --host 192.168.178.20 --port 4300 --disable-host-check --proxy-config proxy.conf.json --verbose",
"start": "nx serve --port 4300 --disable-host-check --verbose",
"start-for-screenreader": "nx serve --host 192.168.178.20 --port 4300 --disable-host-check --verbose",
"start:devbe": "nx serve --port 4300 --disable-host-check --proxy-config proxy.dev.conf.json --verbose",
"build": "nx build",
"test": "node ./node_modules/.bin/nx run-many --target=test --all --parallel --maxParallel 8 --runInBand",
......
export default [
{
"/api": {
"context": [
"/api",
"/sso"
],
"target": {
"host": "localhost",
"port": 8080,
......@@ -8,4 +12,4 @@
"secure": false,
"logLevel": "debug"
}
}
\ No newline at end of file
];
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment