Skip to content

Returning html always return a HTTP 200 status code  #56

Open
@pnwatin

Description

@pnwatin

When using this plugin the handler will always return HTTP 200 code even if status code is explicitly set

reproduction

export const app = new Elysia()
	.use(html())
	.get('/should-return-error', ({set}) => {
		set.status = 422;

		return <div></div>;
	})

it returns http code 200 instead of 422.

Most of the time it's fine. But sometimes (for example using htmx) you want to be able to return html with your error

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions