Skip to content

Commit

Permalink
[style] add 400 description
Browse files Browse the repository at this point in the history
  • Loading branch information
erik1110 committed Jan 24, 2024
1 parent 75e35ba commit 2dc9755
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/features/url/url.controller.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Controller, Get, HttpStatus, Param, Redirect, UseGuards } from '@nestjs/common';
import { Controller, Get, HttpStatus, Param, Redirect } from '@nestjs/common';
import { UrlService } from './url.service';
import { ApiErrorDecorator } from 'src/common/decorators/error/error.decorator';
import { ApiOperation, ApiTags } from '@nestjs/swagger';
Expand All @@ -16,6 +16,7 @@ export class UrlController {

@Get(':shortUrl')
@ApiOperation({ summary: '轉址短網址 Redirect short URL' })
@ApiErrorDecorator(HttpStatus.BAD_REQUEST, 'UserError', '無此網址或網址已失效')
@Redirect()
async redirectToOriginalUrl(@Param('shortUrl') shortUrl: string): Promise<{ url: string }> {
const originalUrl = await this.urlService.getOriginalUrl(shortUrl);
Expand Down

0 comments on commit 2dc9755

Please sign in to comment.