elysiajs / elysia-html

A plugin for Elysia that add support for returning html

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

`html()` is duplicating headers

thekorn opened this issue · comments

when running this simple server

import { Elysia } from 'elysia'

import { html } from '@elysiajs/html';

const app = new Elysia()
  //@ts-ignore
  .use(html())
  //@ts-ignore
  .get('/', ({ set }) => {
    set.headers["test-header"] = "test-value"
    return "<div>hallo</div>"
  })
  //@ts-ignore
  .get('/error', ({ set, html }) => {
    set.headers["test-header"] = "test-value"
    return html("<div>hallo</div>")
  })
  .listen(3001)

console.log(`Elysia is running at ${app.server?.hostname}:${app.server?.port}`)

export type App = typeof app
console.log('Server is running on port 3001.')

I see duplicated test-header values on the /error endpoint, which is using html() whereas on the other endpoint which is not using the plugin the header looks good

grafik

I'm using most recent versions of all packages

/private/tmp/boo node_modules (34)
├── @elysiajs/html@0.6.0
├── bun-types@0.7.3
├── elysia@0.6.11

thanks, this is fixed with recent version of this plugin