0
0
mirror of https://github.com/honojs/hono.git synced 2024-12-01 10:51:01 +00:00

chore: fixed typo

This commit is contained in:
Yusuke Wada 2022-04-20 18:21:20 +09:00
parent 798425a17d
commit f1be3af4be
8 changed files with 15 additions and 15 deletions

View File

@ -74,7 +74,7 @@ describe('Context', () => {
expect(res.statusText).toBe('Created') expect(res.statusText).toBe('Created')
}) })
it('Complext pattern', async () => { it('Complex pattern', async () => {
c.status(404) c.status(404)
const res = c.json({ hono: 'great app' }) const res = c.json({ hono: 'great app' })
expect(res.status).toBe(404) expect(res.status).toBe(404)
@ -108,7 +108,7 @@ describe('Context', () => {
expect(res.status).toBe(201) expect(res.status).toBe(201)
expect(await res.text()).toBe('this is body') expect(await res.text()).toBe('this is body')
// res is already setted. // res is already set.
c.res = res c.res = res
c.header('X-Custom4', 'Message4') c.header('X-Custom4', 'Message4')
c.status(202) c.status(202)

View File

@ -118,7 +118,7 @@ describe('Routing', () => {
const user = app.route('/user') const user = app.route('/user')
user.get('/login', (c) => c.text('get /user/login')) user.get('/login', (c) => c.text('get /user/login'))
user.post('/regist', (c) => c.text('post /user/regist')) user.post('/register', (c) => c.text('post /user/register'))
let res = await app.request('http://localhost/book', { method: 'GET' }) let res = await app.request('http://localhost/book', { method: 'GET' })
expect(res.status).toBe(200) expect(res.status).toBe(200)
@ -139,9 +139,9 @@ describe('Routing', () => {
expect(res.status).toBe(200) expect(res.status).toBe(200)
expect(await res.text()).toBe('get /user/login') expect(await res.text()).toBe('get /user/login')
res = await app.request('http://localhost/user/regist', { method: 'POST' }) res = await app.request('http://localhost/user/register', { method: 'POST' })
expect(res.status).toBe(200) expect(res.status).toBe(200)
expect(await res.text()).toBe('post /user/regist') expect(await res.text()).toBe('post /user/register')
}) })
}) })
@ -193,7 +193,7 @@ describe('Middleware', () => {
await next() await next()
}) })
// Apeend Custom Header // Append Custom Header
app.use('*', async (c, next) => { app.use('*', async (c, next) => {
await next() await next()
c.res.headers.append('x-custom', 'root') c.res.headers.append('x-custom', 'root')

View File

@ -188,7 +188,7 @@ export class Hono {
const wrappedHandler = async (context: Context, next: Next) => { const wrappedHandler = async (context: Context, next: Next) => {
const res = await handler(context) const res = await handler(context)
if (!(res instanceof Response)) { if (!(res instanceof Response)) {
throw new TypeError('response must be a instace of Response') throw new TypeError('response must be a instance of Response')
} }
context.res = res context.res = res
await next() await next()

View File

@ -45,7 +45,7 @@ describe('Logger by Middleware', () => {
}) })
it('Log status 404', async () => { it('Log status 404', async () => {
const msg = 'Default 404 Nout Found' const msg = 'Default 404 Not Found'
app.all('*', (c) => { app.all('*', (c) => {
return c.text(msg, 404) return c.text(msg, 404)
}) })

View File

@ -42,13 +42,13 @@ function log(
method: string, method: string,
path: string, path: string,
status?: number, status?: number,
elasped?: string, elapsed?: string,
contentLength?: string contentLength?: string
) { ) {
const out = const out =
prefix === LogPrefix.Incoming prefix === LogPrefix.Incoming
? ` ${prefix} ${method} ${path}` ? ` ${prefix} ${method} ${path}`
: ` ${prefix} ${method} ${path} ${colorStatus(status)} ${elasped} ${contentLength}` : ` ${prefix} ${method} ${path} ${colorStatus(status)} ${elapsed} ${contentLength}`
fn(out) fn(out)
} }

View File

@ -44,14 +44,14 @@ describe('Mustache by Middleware', () => {
return c.render('index') return c.render('index')
}) })
it('Mustache template redering', async () => { it('Mustache template rendering', async () => {
const req = new Request('http://localhost/foo') const req = new Request('http://localhost/foo')
const res = await app.dispatch(req) const res = await app.dispatch(req)
expect(res.status).toBe(200) expect(res.status).toBe(200)
expect(await res.text()).toBe('<html><body>Title: Hono!</body></html>') expect(await res.text()).toBe('<html><body>Title: Hono!</body></html>')
}) })
it('Mustache template redering with root', async () => { it('Mustache template rendering with root', async () => {
const req = new Request('http://localhost/bar') const req = new Request('http://localhost/bar')
const res = await app.dispatch(req) const res = await app.dispatch(req)
expect(res.status).toBe(200) expect(res.status).toBe(200)

View File

@ -34,7 +34,7 @@ describe('Parse Body Middleware', () => {
expect(await parseBody(req)).toEqual({ message: 'hello' }) expect(await parseBody(req)).toEqual({ message: 'hello' })
}) })
it('should parse Reponse body ', async () => { it('should parse Response body ', async () => {
const payload = 'hello' const payload = 'hello'
const res = new Response(payload, { const res = new Response(payload, {
headers: { headers: {

View File

@ -17,7 +17,7 @@ describe('crypto', () => {
expect(await sha1('abcdedf')).not.toBe('abcdef') expect(await sha1('abcdedf')).not.toBe('abcdef')
}) })
it('encodeBaes64', () => { it('encodeBase64', () => {
expect(encodeBase64('hooooooooo')).toBe('aG9vb29vb29vbw==') expect(encodeBase64('hooooooooo')).toBe('aG9vb29vb29vbw==')
expect(encodeBase64('炎')).toBe('54KO') expect(encodeBase64('炎')).toBe('54KO')
expect(encodeBase64('abcdef')).not.toBe('abcdedf') expect(encodeBase64('abcdef')).not.toBe('abcdedf')
@ -27,7 +27,7 @@ describe('crypto', () => {
}).toThrow(TypeError) }).toThrow(TypeError)
}) })
it('decodeBaes64', async () => { it('decodeBase64', async () => {
expect(decodeBase64('aG9vb29vb29vbw==')).toBe('hooooooooo') expect(decodeBase64('aG9vb29vb29vbw==')).toBe('hooooooooo')
expect(decodeBase64('54KO')).toBe('炎') expect(decodeBase64('54KO')).toBe('炎')
expect(decodeBase64('abcdedf')).not.toBe('abcdef') expect(decodeBase64('abcdedf')).not.toBe('abcdef')