-
|
Any pointers to the best way to handle a POST of a blob body to a url with path variables ( I'm not sure how to express that input as the path variables, such as channel and timestamp, are named, but the body isn't: input: z.object({
channel: z
.string()
.describe("channel string"),
timestamp: z
.number()
.nonnegative()
.describe("epoch timestamp"),
body?: z.instanceof( Blob ),I've read the docs, but I'm still not getting it - sorry if the answer to this is obvious and I'm just missing it. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
|
Hello @lpw Path params (which I presume you meant by "variables"), should be specified with /:channel/:timestampTherefore, the const routing: Routing = {
":channel": {
":timestamp": theEndpoint
}
};See https://ez.robintail.cz/v27.0.1/routing for more examples. Regarding the However, if you use the See also |
Beta Was this translation helpful? Give feedback.
-
|
Hi, and thanks for the quick reply! Yes, indeed my routing is setup with But I seem to be having a general problem posting raw blobs or buffers. I'm now running the just the example code which has an endpoint But this is working when I post blobs via curl - I need to understand what's different about my client (sorry for the distraction)... |
Beta Was this translation helpful? Give feedback.
Hello @lpw
Path params (which I presume you meant by "variables"), should be specified with
:symbol in path for Express:Therefore, the
Routingobject should look this way:See https://ez.robintail.cz/v27.0.1/routing for more examples.
Regarding the
Blobinstance — i'm not sure, because theinputschema validates against the already parsed request properties combined. There is nobodyitself by default and Endpoints have no access to original request (by default).However, if you use the
ez.raw()schema as theinput(and you're using thecreateServer()approach), the body would be parsed by