Skip to content

Default content-type to 'application/octect-stream'#128

Merged
alexindigo merged 1 commit intoform-data:masterfrom
DylanPiercey:master
Jul 24, 2015
Merged

Default content-type to 'application/octect-stream'#128
alexindigo merged 1 commit intoform-data:masterfrom
DylanPiercey:master

Conversation

@DylanPiercey
Copy link
Copy Markdown
Member

Resolves #118.

Also fixes #54.

@DylanPiercey
Copy link
Copy Markdown
Member Author

I've extended this PR to include default content types for buffers as well. #54

It also refactors the code a bit to allow for filename to be optional in accordance with #124.

Comment thread lib/form_data.js Outdated
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Do you mind to make it a "constant", similar to FormData.LINE_BREAK?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

FormData.DEFAULT_CONTENT_TYPE = 'application/octet-stream';

Good enough?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

This has been fixed :).

@alexindigo
Copy link
Copy Markdown
Member

Great stuff! Thank you very much. Few minor comments, but in general is super awesome. Thank you very much for do it.

@DylanPiercey
Copy link
Copy Markdown
Member Author

I have made most of the changes you recommended. Let me know if anymore work is needed to get this merged. 👍

@alexindigo
Copy link
Copy Markdown
Member

Thank you. Looks much better than it was before. :) I'd like to try another iteration on conditional content-type asserts.

@alexindigo
Copy link
Copy Markdown
Member

@felixge What do you think on another Santa's helper? :)

@DylanPiercey
Copy link
Copy Markdown
Member Author

Hows that?

Comment thread test/integration/test-pipe.js Outdated
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Great! More verbose where it needs to be and more concise where details not important.

I think we don't need type for this one, it's not a file, so we don't send Content-Type along and we don't check for it. Am I right?

Other than that it's 👍

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Good point, checking it out now.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Fixed now, missed that this was a field not a file.

Edit: Apparently the build is failing now, trying to fix.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Build failed initially but now is passing. I cannot replicate this on my local machine, perhaps it would be formidable calling it's event emitters out of sync but I'm not entirely sure.

Whats your thoughts @alexindigo?

@alexindigo
Copy link
Copy Markdown
Member

Perfect. Thanks. Checking failed builds.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Yep. Build was right. Parsing could take longer for some things.

AssertionError: 'remote_file' === 'my_file'
    at IncomingForm.<anonymous> (/home/travis/build/felixge/node-form-data/test/integration/test-submit-custom-header.js:53:14)
    at emitTwo (events.js:87:13)
    at IncomingForm.emit (events.js:172:7)
    at /home/travis/build/felixge/node-form-data/node_modules/formidable/lib/incoming_form.js:229:12
    at WriteStream.<anonymous> (/home/travis/build/felixge/node-form-data/node_modules/formidable/lib/file.js:70:5)
    at WriteStream.g (events.js:260:16)
    at emitNone (events.js:72:20)
    at WriteStream.emit (events.js:166:7)
    at finishMaybe (_stream_writable.js:468:14)
    at afterWrite (_stream_writable.js:347:3)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
iojs /home/travis/build/felixge/node-form-data/test/integration/test-submit-custom-header.js

Let's make it hash instead of array, with name as the key, to avoid failing for nothing builds.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I'll try to get to this tonight. If not tomorrow.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thank you very much for all the work.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

No problem, using this lib in a few sites, glad to see strictish PRs.

Also, found some time, it's fixed now. 👍

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thank you.

And strictishness is not the goal. :) Tests saved our necks quite a few times, so we're trying to be careful about them. Especially in the light of this library being used not only with end-user apps, but as part of other libraries. Biggest customer for us is request module, it won't be fun to break things for so many people.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Very much agree. Was not aware of request using this.
Thanks for merging.

Unrelated - Is there a better medium to contact you for future PR's without cluttering the comments? I also have some questions.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I'm one of the maintainers, so issues here would be better way to discuss library specific questions. Although for faster turnaround, you can find me on gtalk ([email protected]).

Actually I'm thinking maybe it's time to create some kind of general chat room. Like I noticed Electron has it's own Slack org.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

https://gitter.im works really well also - and is simple to setup.

Slack is also great though.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

alexindigo added a commit that referenced this pull request Jul 24, 2015
Default content-type to 'application/octect-stream'
@alexindigo alexindigo merged commit f00b4b9 into form-data:master Jul 24, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Content-Type "false" set when file does not have an extension

2 participants