Skip to content

Commit 991011f

Browse files
authored
fix(requests): use relative request paths (#1175)
* use relative authority * use relative request path
1 parent 917f011 commit 991011f

File tree

5 files changed

+9
-10
lines changed

5 files changed

+9
-10
lines changed

src/app/Shared/Services/Login.service.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ export class LoginService {
4040
private readonly authCredentials: AuthCredentials,
4141
private readonly settings: SettingsService,
4242
) {
43-
this.authority = process.env.CRYOSTAT_AUTHORITY || '';
43+
this.authority = process.env.CRYOSTAT_AUTHORITY || '.';
4444
this.token.next(this.getCacheItem(this.TOKEN_KEY));
4545
this.username.next(this.getCacheItem(this.USER_KEY));
4646
this.authMethod.next(this.getCacheItem(this.AUTH_METHOD_KEY) as AuthMethod);

src/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
<title>Cryostat</title>
2222
<meta id="appName" name="application-name" content="Cryostat">
2323
<meta name="viewport" content="width=device-width, initial-scale=1.0">
24-
<base href="/">
24+
<base href="./">
2525
</head>
2626

2727
<body>

src/mirage/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -399,7 +399,7 @@ export const startMirage = ({ environment = 'development' } = {}) => {
399399
},
400400
]);
401401
this.get('api/v2/probes', () => []);
402-
this.post('/api/beta/matchExpressions', (_, request) => {
402+
this.post('api/beta/matchExpressions', (_, request) => {
403403
const attr = JSON.parse(request.requestBody);
404404
if (!attr.matchExpression || !attr.targets) {
405405
return new Response(400);

src/test/Shared/Services/Login.service.test.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ describe('Login.service', () => {
117117
it('should make expected API calls', async () => {
118118
await firstValueFrom(svc.setLoggedOut());
119119
expect(mockFromFetch).toHaveBeenCalledTimes(3);
120-
expect(mockFromFetch).toHaveBeenNthCalledWith(2, `/api/v2.1/auth`, {
120+
expect(mockFromFetch).toHaveBeenNthCalledWith(2, `./api/v2.1/auth`, {
121121
credentials: 'include',
122122
mode: 'cors',
123123
method: 'POST',
@@ -126,7 +126,7 @@ describe('Login.service', () => {
126126
Authorization: `Basic dXNlcjpkNzRmZjBlZThkYTNiOTgwNmIxOGM4NzdkYmYyOWJiZGU1MGI1YmQ4ZTRkYWQ3YTNhNzI1MDAwZmViODJlOGYx`,
127127
}),
128128
});
129-
expect(mockFromFetch).toHaveBeenNthCalledWith(3, `/api/v2.1/logout`, {
129+
expect(mockFromFetch).toHaveBeenNthCalledWith(3, `./api/v2.1/logout`, {
130130
credentials: 'include',
131131
mode: 'cors',
132132
method: 'POST',
@@ -230,7 +230,7 @@ describe('Login.service', () => {
230230
it('should make expected API calls', async () => {
231231
await firstValueFrom(svc.setLoggedOut());
232232
expect(mockFromFetch).toHaveBeenCalledTimes(3);
233-
expect(mockFromFetch).toHaveBeenNthCalledWith(1, `/api/v2.1/auth`, {
233+
expect(mockFromFetch).toHaveBeenNthCalledWith(1, `./api/v2.1/auth`, {
234234
credentials: 'include',
235235
mode: 'cors',
236236
method: 'POST',
@@ -239,7 +239,7 @@ describe('Login.service', () => {
239239
Authorization: `Bearer c2hhMjU2fmhlbGxvd29ybGQ`,
240240
}),
241241
});
242-
expect(mockFromFetch).toHaveBeenNthCalledWith(2, `/api/v2.1/logout`, {
242+
expect(mockFromFetch).toHaveBeenNthCalledWith(2, `./api/v2.1/logout`, {
243243
credentials: 'include',
244244
mode: 'cors',
245245
method: 'POST',
@@ -248,7 +248,7 @@ describe('Login.service', () => {
248248
Authorization: `Bearer c2hhMjU2fmhlbGxvd29ybGQ`,
249249
}),
250250
});
251-
expect(mockFromFetch).toHaveBeenNthCalledWith(3, `/api/v2.1/auth`, {
251+
expect(mockFromFetch).toHaveBeenNthCalledWith(3, `./api/v2.1/auth`, {
252252
credentials: 'include',
253253
mode: 'cors',
254254
method: 'POST',

webpack.common.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ const HtmlWebpackPlugin = require('html-webpack-plugin');
33
const TsconfigPathsPlugin = require('tsconfig-paths-webpack-plugin');
44

55
const BG_IMAGES_DIRNAME = 'bgimages';
6-
const ASSET_PATH = process.env.ASSET_PATH || '/';
76

87
module.exports = (env) => {
98
return {
@@ -154,7 +153,7 @@ module.exports = (env) => {
154153
chunkFilename: '[id].[contenthash].bundle.js', // lazy-load modules
155154
hashFunction: "xxhash64",
156155
path: path.resolve(__dirname, 'dist'),
157-
publicPath: ASSET_PATH,
156+
publicPath: 'auto',
158157
clean: true
159158
},
160159
resolve: {

0 commit comments

Comments
 (0)