Skip to content
Myr

chore: fixed typo

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Yusuke Wada · committed by Yusuke Wada · parent 798425a · Browse files · 8 files+15 added−15 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

8 files+15 added−15 removed

  • tests:+12 added−12 removed
  • other:+3 added−3 removed

8 files+15 added−15 removed

modified:src/middleware/logger/index.test.ts+1 added-1 removed
modified:src/middleware/logger/index.ts+2 added-2 removed
modified:src/middleware/mustache/index.test.ts+2 added-2 removed
modified:src/utils/body.test.ts+1 added-1 removed
32 unmodified lines
33 })34 expect(await parseBody(req)).toEqual({ message: 'hello' })35 })3637 it('should parse Reponse body ', async () => {37 it('should parse Response body ', async () => {38 const payload = 'hello'39 const res = new Response(payload, {40 headers: {41 'Content-Type': 'text/plain',
6 unmodified lines
modified:src/utils/crypto.test.ts+2 added-2 removed
15 unmodified lines
16 expect(await sha1('炎')).toBe('d56e09ae2421b2b8a0b5ee5fdceaed663c8c9472')17 expect(await sha1('abcdedf')).not.toBe('abcdef')18 })1920 it('encodeBaes64', () => {20 it('encodeBase64', () => {21 expect(encodeBase64('hooooooooo')).toBe('aG9vb29vb29vbw==')22 expect(encodeBase64('炎')).toBe('54KO')23 expect(encodeBase64('abcdef')).not.toBe('abcdedf')24 expect(encodeBase64('')).toBe('')
1 unmodified line
26 encodeBase64(null)27 }).toThrow(TypeError)28 })2930 it('decodeBaes64', async () => {30 it('decodeBase64', async () => {31 expect(decodeBase64('aG9vb29vb29vbw==')).toBe('hooooooooo')32 expect(decodeBase64('54KO')).toBe('炎')33 expect(decodeBase64('abcdedf')).not.toBe('abcdef')34 expect(decodeBase64('')).toBe('')
5 unmodified lines
modified:src/context.test.ts+2 added-2 removed
72 unmodified lines
73 expect(res.status).toBe(201)74 expect(res.statusText).toBe('Created')75 })7677 it('Complext pattern', async () => {77 it('Complex pattern', async () => {78 c.status(404)79 const res = c.json({ hono: 'great app' })80 expect(res.status).toBe(404)81 expect(res.statusText).toBe('Not Found')
25 unmodified lines
107 expect(res.headers.get('X-Custom3')).toBe('Message3')108 expect(res.status).toBe(201)109 expect(await res.text()).toBe('this is body')110111 // res is already setted.111 // res is already set.112 c.res = res113 c.header('X-Custom4', 'Message4')114 c.status(202)115 expect(c.res.headers.get('X-Custom4')).toBe('Message4')
10 unmodified lines
modified:src/hono.test.ts+4 added-4 removed
116 unmodified lines
117 book.post('/', (c) => c.text('post /book'))118119 const user = app.route('/user')120 user.get('/login', (c) => c.text('get /user/login'))121 user.post('/regist', (c) => c.text('post /user/regist'))121 user.post('/register', (c) => c.text('post /user/register'))122123 let res = await app.request('http://localhost/book', { method: 'GET' })124 expect(res.status).toBe(200)125 expect(await res.text()).toBe('get /book')
12 unmodified lines
138 res = await app.request('http://localhost/user/login', { method: 'GET' })139 expect(res.status).toBe(200)140 expect(await res.text()).toBe('get /user/login')141142 res = await app.request('http://localhost/user/regist', { method: 'POST' })142 res = await app.request('http://localhost/user/register', { method: 'POST' })143 expect(res.status).toBe(200)144 expect(await res.text()).toBe('post /user/regist')144 expect(await res.text()).toBe('post /user/register')145 })146})147148describe('param and query', () => {
43 unmodified lines
192 console.log(`${c.req.method} : ${c.req.url}`)193 await next()194 })195196 // Apeend Custom Header196 // Append Custom Header197 app.use('*', async (c, next) => {198 await next()199 c.res.headers.append('x-custom', 'root')200 })
145 unmodified lines
modified:src/hono.ts+1 added-1 removed
186 unmodified lines
187188 const wrappedHandler = async (context: Context, next: Next) => {189 const res = await handler(context)190 if (!(res instanceof Response)) {191 throw new TypeError('response must be a instace of Response')191 throw new TypeError('response must be a instance of Response')192 }193 context.res = res194 await next()195 }
31 unmodified lines