Comments (7)
Should be fix on 321a7c5, published under 1.0.21
from elysia.
@SaltyAom, It still converts the cookie value to number
even though I specified t.String
as the type
nvm, bun installed wrong version 😭
from elysia.
BUT i got an error when passing 123
:
{
"type": "validation",
"on": "cookie",
"property": "/hello",
"message": "Expected string",
"expected": {
"hello": ""
},
"found": {
"hello": 123
},
"errors": [
{
"type": 54,
"schema": {
"type": "string"
},
"path": "/hello",
"value": 123,
"message": "Expected string"
}
]
}
from elysia.
same bug with new Elysia({ aot: false })
from elysia.
Does this error still occur on the latest (1.0.22)?
![Screenshot 2567-06-09 at 18 00 24](https://private-user-images.githubusercontent.com/35027979/337966736-73d47541-1dde-431f-a632-69025ff9b030.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MTkwOTA4NTIsIm5iZiI6MTcxOTA5MDU1MiwicGF0aCI6Ii8zNTAyNzk3OS8zMzc5NjY3MzYtNzNkNDc1NDEtMWRkZS00MzFmLWE2MzItNjkwMjVmZjliMDMwLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA2MjIlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwNjIyVDIxMDkxMlomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTBmZGVjNDMwNDcyNTIzOWMzMjA4YjdiNGY0NzMyNTU0NDEyNzliNTI5NGY5ODE4MWVkZjQ1M2RmMTYzMzg3NWQmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.sIPOlMOqqPrj4Z7FcWLlqsUsIgySQRlogpYd1KuAlNo)
from elysia.
@SaltyAom, yes, it occurs on 1.0.23
, you have to pass number instead of some char sequence:
and the handler has this schema:
{ cookie: t.Cookie({ hello: t.String() }) }
32
is a valid string
, idk why it errors there. it doesnt do that in other cases
from elysia.
Like this test doesn't pass...
import { describe, it, expect } from "bun:test";
import { Elysia, t } from "elysia";
describe("Cookie", () => {
it("???", async () => {
const app = new Elysia().get("/", ({ cookie: { hello } }) => hello.value, {
cookie: t.Cookie({
hello: t.String(),
}),
});
const response = await app.handle(
new Request("http://localhost/", {
headers: {
Cookie: "hello=42",
},
})
);
expect(await response.text()).toEqual("42");
});
});
from elysia.
Related Issues (20)
- no `base64` in `t.String()` `format` option. Also no type support for the `byte` option.
- t.Literal type is ignored in favor of string during validation
- Eden Treaty ignores t.Transform()
- "default" option is not being applied on validation HOT 5
- Ability to create and remove websocket endpoints at runtime.
- Macro modify schema HOT 1
- Rxjs pipe syntax
- Nullable field for types as documented in OpenAPI 3.0 HOT 1
- Support for classes and getter fields
- Transform type (include Date) won't transform in Array schema
- Decorates are replacing each other HOT 5
- Query params validation for array of string fail at 1.0.23 HOT 5
- Plugin registered by async inline function don't work
- Cookie Schema doesn't work in instances HOT 1
- Return 405 error for wrong method on a resource, rather than 404
- Failed to bind socket in linux
- `mapResponse` is completely ignored HOT 2
- Please Export Typebox Types HOT 1
- staticPlugin didn't supply chinese path
- Context object not correctly passed to handler HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from elysia.