enabled request validation

main
Inga 🏳‍🌈 2 years ago
parent adcd57e60c
commit 540a2de74b
  1. 16
      client/simpleform/index.html
  2. 11
      package-lock.json
  3. 1
      package.json
  4. 2
      src/main.ts
  5. 2
      src/screenshots/screenshots.dto.ts

@ -1,4 +1,16 @@
<form action="/screenshots" method="POST" target="_blank">
<input type="text" name="a">
<input type="text" name="b"><input type="submit">
<table>
<tr>
<td>URL</td>
<td><input type="text" name="pageUrl"></td>
</tr>
<tr>
<td>Type</td>
<td><input type="text" name="imageType" value="png"></td>
</tr>
<tr>
<td>&nbsp;</td>
<td><input type="submit"></td>
</tr>
</table>
</form>

11
package-lock.json generated

@ -16,6 +16,7 @@
"@nestjs/platform-express": "^9.0.0",
"@nestjs/serve-static": "^3.0.0",
"@nestjs/swagger": "^6.0.1",
"class-transformer": "^0.5.1",
"class-validator": "^0.13.2",
"puppeteer": "^15.3.2",
"reflect-metadata": "^0.1.13",
@ -3184,6 +3185,11 @@
"integrity": "sha512-cOU9usZw8/dXIXKtwa8pM0OTJQuJkxMN6w30csNRUerHfeQ5R6U3kkU/FtJeIf3M202OHfY2U8ccInBG7/xogA==",
"dev": true
},
"node_modules/class-transformer": {
"version": "0.5.1",
"resolved": "https://registry.npmjs.org/class-transformer/-/class-transformer-0.5.1.tgz",
"integrity": "sha512-SQa1Ws6hUbfC98vKGxZH3KFY0Y1lm5Zm0SY8XX9zbK7FJCyVEac3ATW0RIpwzW+oOfmHE5PMPufDG9hCfoEOMw=="
},
"node_modules/class-validator": {
"version": "0.13.2",
"resolved": "https://registry.npmjs.org/class-validator/-/class-validator-0.13.2.tgz",
@ -11399,6 +11405,11 @@
"integrity": "sha512-cOU9usZw8/dXIXKtwa8pM0OTJQuJkxMN6w30csNRUerHfeQ5R6U3kkU/FtJeIf3M202OHfY2U8ccInBG7/xogA==",
"dev": true
},
"class-transformer": {
"version": "0.5.1",
"resolved": "https://registry.npmjs.org/class-transformer/-/class-transformer-0.5.1.tgz",
"integrity": "sha512-SQa1Ws6hUbfC98vKGxZH3KFY0Y1lm5Zm0SY8XX9zbK7FJCyVEac3ATW0RIpwzW+oOfmHE5PMPufDG9hCfoEOMw=="
},
"class-validator": {
"version": "0.13.2",
"resolved": "https://registry.npmjs.org/class-validator/-/class-validator-0.13.2.tgz",

@ -28,6 +28,7 @@
"@nestjs/platform-express": "^9.0.0",
"@nestjs/serve-static": "^3.0.0",
"@nestjs/swagger": "^6.0.1",
"class-transformer": "^0.5.1",
"class-validator": "^0.13.2",
"puppeteer": "^15.3.2",
"reflect-metadata": "^0.1.13",

@ -1,9 +1,11 @@
import { ValidationPipe } from '@nestjs/common';
import { NestFactory } from '@nestjs/core';
import { SwaggerModule, DocumentBuilder } from '@nestjs/swagger';
import { AppModule } from './app.module';
async function bootstrap() {
const app = await NestFactory.create(AppModule);
app.useGlobalPipes(new ValidationPipe({ transform: true }));
const config = new DocumentBuilder().build();
const document = SwaggerModule.createDocument(app, config);

@ -1,4 +1,4 @@
import { IsEnum, IsString, IsUrl } from "class-validator";
import { IsEnum, IsNotEmpty, IsString, IsUrl } from "class-validator";
enum ImageTypeDto {
Jpeg = 'jpeg',

Loading…
Cancel
Save