New Jan 6, 2025

How to pass data from client to middleware in uploadthing?

Libraries, Frameworks, etc. All from Newest questions tagged reactjs - Stack Overflow View How to pass data from client to middleware in uploadthing? on stackoverflow.com

I have the button from uploadthing and i try to pass data by headers to the middleware but i get noting.

the button:

      <UploadButton
        endpoint="imageUploader"
        headers={{
          "X-Custom-Header": "custom-value22222222", // data i test to submit
          data: "test",
        }}

the middleware:

  .middleware(async ({ req }) => {

console.log('middleware to get test data header:', req) // can't get above headers

return { userId: user.id}; })

any ideas? their docs are not fully complete

Scroll to top