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

feat - new promise based api #140

Merged
merged 81 commits into from
Aug 25, 2020
Merged

Conversation

StarpTech
Copy link
Member

@StarpTech StarpTech commented Aug 9, 2020

This is a preview of the new interface. I appreciate any feedback. Tests suite is incomplete but the features are working already.

Checkout the examples to get a better impression or play with the form.html

Related: #109, #139

Checklist

@jsumners
Copy link
Member

jsumners commented Aug 9, 2020

I rather prefer the original interface. This strikes me as too inflexible.

@StarpTech
Copy link
Member Author

Could you be more specific? What do you miss?

Copy link
Member

@mcollina mcollina left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like this API quite a lot, I think it'd be more usable for the majority of use cases. It also looks a lot like a new module to me.

index.js Outdated Show resolved Hide resolved
test/big.test.js Show resolved Hide resolved
index.js Outdated Show resolved Hide resolved
index.js Outdated Show resolved Hide resolved
test/append-body.test.js Show resolved Hide resolved
@jsumners
Copy link
Member

Could you be more specific? What do you miss?

It looks to me like this implementation assumes "file" uploads and always writes the data out to a file on the filesystem. Multipart isn't always about uploading files. In particular, I have a case where I need to look for a part named "json" and read the data attached to it as an object; I have no need of writing this to the filesystem.

@StarpTech
Copy link
Member Author

StarpTech commented Aug 10, 2020

It looks to me like this implementation assumes "file" uploads and always writes the data out to a file on the filesystem. Multipart isn't always about uploading files. In particular, I have a case where I need to look for a part named "json" and read the data attached to it as an object; I have no need of writing this to the filesystem.

Oh no, please check out all examples. You can work with just streams or files in disk mode.

@jsumners
Copy link
Member

It also looks a lot like a new module to me.

At a minimum, I agree with this statement. One reason I think a major framework has recently been deprecated is due to the way it was routinely using semver major to release what amounted to new frameworks under the same name. This PR completely changes the API for this module, and will be a significant hinderance to people using the module. I think that is a worse developer experience than the current API.

@StarpTech
Copy link
Member Author

StarpTech commented Aug 10, 2020

Wow, why so negative? Let focus at first on the PR. We can discuss afterward how we can incorporate that in the fastify ecosystem.

@jsumners
Copy link
Member

I'm not seeing any negativity in my statement. I only stated that I agree this module should remain as-is.

@StarpTech
Copy link
Member Author

I'm not seeing any negativity in my statement. I only stated that I agree this module should remain as-is.

You made it already clear with your first comment.

index.js Outdated Show resolved Hide resolved
index.js Outdated Show resolved Hide resolved
@StarpTech
Copy link
Member Author

StarpTech commented Aug 15, 2020

@mcollina on windows the tests npm test will run in a timeout. When I run the tests via node they will fail only occasionally. (On Linux all test running successfully)

E.g it will be stuck.

$ node test/multipart-stream.test.js 
TAP version 13
# Subtest: should throw fileSize limitation error on small payload
    1..4
    ok 1 - expect truthy value
    ok 2 - should be equal

It looks like it's not related to a specific test. On my machine 'should throw fileSize limitation error on small payload' and 'should not allow __proto__ as file name' fail regularly. Perhaps you find the bug in the code.

@StarpTech
Copy link
Member Author

@mcollina I could fix it 😄

@mcollina
Copy link
Member

go for a fix! I don't have a clue - the first is likely due to difference in the network stack.

@StarpTech
Copy link
Member Author

StarpTech commented Aug 16, 2020

On windows ci npm install does not even start 🤯 On MAC the tests failing. On Linux everything works fine. I need some help.

Copy link
Member

@mcollina mcollina left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Really good work! I've left some comments and a few nits.

README-legacy.md Outdated Show resolved Hide resolved
index.js Outdated Show resolved Hide resolved
index.js Outdated Show resolved Hide resolved
index.js Show resolved Hide resolved
index.js Outdated Show resolved Hide resolved
index.js Outdated Show resolved Hide resolved
Copy link
Member

@mcollina mcollina left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm, let's wait for the others anyway.

@StarpTech
Copy link
Member Author

lgtm, let's wait for the others anyway.

@mcollina I will wait for one more. The activity here is extremely low. I'd like to use this module.

README-legacy.md Outdated Show resolved Hide resolved
@mcollina
Copy link
Member

Can you change the title of this PR?

@StarpTech StarpTech changed the title first poc feat - new promise based api Aug 25, 2020
Copy link
Member

@delvedor delvedor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@StarpTech StarpTech merged commit c353f7f into fastify:master Aug 25, 2020
@StarpTech StarpTech deleted the feat/new_api_poc branch August 25, 2020 19:30
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

Successfully merging this pull request may close these issues.

6 participants