Commit 9a63e9ea authored by Ли Джен Сеп's avatar Ли Джен Сеп 💬

#5 Добавил удаление пробела

parent 6ed9bec4
......@@ -6,7 +6,7 @@ import { CreateMessageDto } from './dto/create-message.dto';
export class MessageController {
constructor(private readonly messageService: MessageService) {}
@Post('encode')
@Post('/encode')
encodeMessage(@Body() createMessageDto: CreateMessageDto): {
encoded: string;
} {
......@@ -15,7 +15,7 @@ export class MessageController {
return { encoded };
}
@Post('decode')
@Post('/decode')
decodeMessage(@Body() createMessageDto: CreateMessageDto): {
decoded: string;
} {
......
......@@ -4,10 +4,10 @@ import { Vigenere } from 'caesar-salad';
@Injectable()
export class MessageService {
encodeMessage(password: string, message: string): string {
return Vigenere.Cipher(password).crypt(message);
return Vigenere.Cipher(password.trim()).crypt(message);
}
decodeMessage(password: string, message: string): string {
return Vigenere.Decipher(password).crypt(message);
return Vigenere.Decipher(password.trim()).crypt(message);
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment