Skip to content

Commit

Permalink
fix: bug fix - end the response when projectScopedStickiness is dis…
Browse files Browse the repository at this point in the history
…abled (#3332)

This PR fixes a bug where the api call to getProjectSettings was left
hanging because no `end` was specified on the server

<!-- Thanks for creating a PR! To make it easier for reviewers and
everyone else to understand what your changes relate to, please add some
relevant content to the headings below. Feel free to ignore or delete
sections that you don't think are relevant. Thank you! ❤️ -->

## About the changes
<!-- Describe the changes introduced. What are they and why are they
being introduced? Feel free to also add screenshots or steps to view the
changes if they're visual. -->

<!-- Does it close an issue? Multiple? -->
Closes #

<!-- (For internal contributors): Does it relate to an issue on public
roadmap? -->
<!--
Relates to [roadmap](https://github.com/orgs/Unleash/projects/10) item:
#
-->

### Important files
<!-- PRs can contain a lot of changes, but not all changes are equally
important. Where should a reviewer start looking to get an overview of
the changes? Are any files particularly important? -->


## Discussion points
<!-- Anything about the PR you'd like to discuss before it gets merged?
Got any questions or doubts? -->

---------

Signed-off-by: andreas-unleash <andreas@getunleash.ai>
Co-authored-by: Nuno Góis <github@nunogois.com>
  • Loading branch information
andreas-unleash and nunogois committed Mar 16, 2023
1 parent 0db5c14 commit 65f4f88
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/lib/routes/admin-api/project/index.ts
Expand Up @@ -28,6 +28,7 @@ import { OpenApiService, SettingService } from '../../../services';
import { IAuthRequest } from '../../unleash-types';
import { ProjectApiTokenController } from './api-token';
import ProjectArchiveController from './project-archive';
import NotFoundError from '../../../error/notfound-error';

const STICKINESS_KEY = 'stickiness';
const DEFAULT_STICKINESS = 'default';
Expand Down Expand Up @@ -164,8 +165,7 @@ export default class ProjectApi extends Controller {
res: Response<ProjectSettingsSchema>,
): Promise<void> {
if (!this.config.flagResolver.isEnabled('projectScopedStickiness')) {
res.status(404);
return Promise.resolve();
throw new NotFoundError('Project scoped stickiness is not enabled');
}
const { projectId } = req.params;
const stickinessSettings = await this.settingService.get<object>(
Expand All @@ -192,8 +192,7 @@ export default class ProjectApi extends Controller {
res: Response<ProjectSettingsSchema>,
): Promise<void> {
if (!this.config.flagResolver.isEnabled('projectScopedStickiness')) {
res.status(404);
return Promise.resolve();
throw new NotFoundError('Project scoped stickiness is not enabled');
}
const { projectId } = req.params;
const { defaultStickiness } = req.body;
Expand Down

0 comments on commit 65f4f88

Please sign in to comment.