Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sending extra data with the response #422

Closed
Pitu opened this issue Apr 28, 2023 · 9 comments
Closed

Sending extra data with the response #422

Pitu opened this issue Apr 28, 2023 · 9 comments

Comments

@Pitu
Copy link

Pitu commented Apr 28, 2023

What's the best way to append some data to the response sent to the user once an upload finishes?
I'd like to append extra data to the response sent to the user on onUploadFinish but I'm not sure how to do so. I'm using Uppy core with TUS as the uploader and everything I tried so far to append data to the body has been unsuccessful.

Any tips?

@Murderlon
Copy link
Member

Hi, could you be more specific? Do you mean headers? Alter the body of the request?

@primemb
Copy link

primemb commented May 3, 2023

I think it's really needed too right now after the upload is finished on the front side how we should pass front some data to continue the chain of progress? for example, imagine having a website for transcoding movies when a user upload file i want to return back file id which is stored in the database so it can continue the chain of progress. i think must add a way to pass some data after the upload is finished to the front

@Murderlon
Copy link
Member

There are currently discussions in tusd for a similar feature, being able to change the metadata: tus/tusd#814. Would be nice to align on a solution together with tusd.

@Pitu Pitu closed this as completed Jun 24, 2023
@ggagosh
Copy link

ggagosh commented Jul 8, 2023

Hey, is this feature already implemented or there is a way (I can't find it) to add some meta information to the onUploadFinish response? 🤔

P.S. Sorry for commenting on a closed issue, but there is no additional comment why it's closed 😄

P.P.S. I just add a custom header to the response, which js clients can use to get information, but I think it's the hacky way.

@Pitu
Copy link
Author

Pitu commented Jul 8, 2023

@ggagosh I closed it since I moved away from tus to something that better fits my needs

@Murderlon
Copy link
Member

I still want to implement this for the onUploadCreate hook, similar to this PR: tus/tusd#962.

I'm not sure yet what we can/want to allow for onUploadFinish.

@ggagosh
Copy link

ggagosh commented Jul 11, 2023

@Murderlon but why? For example, when onUploadFinish is triggered, I get the Upload object and create db File. I want to return this file object for the client application.

As I mention I set the custom header and return created File id, but it's nice if there is possibility to return some custom response

@Murderlon
Copy link
Member

At the time of onUploadFinish, the upload has already been written to the store, so there is no point in allowing to modify the passed upload. As for the response, you're already able to do res.setHeader(), what more would you want to do and why?

@sammibajrami
Copy link

Hi, I'll just interject to give my answer to your question @Murderlon, which is that I want to be able to add some info that comes from the server to the metadata-object that the server returns to the client.
I don't want to make any changes to the uploaded file.

Like you said I could simply send the additional data along as a response-header but like @ggagosh said that feels a bit hacky

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants