-
Notifications
You must be signed in to change notification settings - Fork 11
Make sure we can add resources with same name. Ie no overwrite #32
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
Conversation
Thank you for the very fast response! After applying the fix, the parts are no longer overwritten. As it stands, this is most probably a BC break as the old behavior is explicitly mentioned in the docs:
|
Thank you. I missed that... I wonder why I would write that. I need to do some more research before I can merge this. It seams to be the right thing to do but Im not sure.. |
So, here is what I concluded: $builder->addResource('foo', 'content');
// Same as
$builder->addResource('whatever', 'content', ['content-disposition'=>'form-data; name="foo"']); One could remove the first parameter of Resource names SHOULD be unique. If same name is used one SHOULD use the array syntax. Ie "foo[0]", "foo[1]" etc. But this is not a hard requirement (MUST) and I think we should be flexible rather then opinionated. I vote for merging this PR in the current state and release 0.2.0. The difference between 0.1.x and 0.2.0 would be that all resources you add to the builder will be added to the stream. You cannot overwrite. Though, resources may have the same POST name and some servers cannot handle that. |
## 0.1.6 - 2017-02-16 | ||
|
||
### Fixed | ||
|
||
- Performance improvements by avoid using `uniqid()`. | ||
- Make sure one can add resources with same name without overwrite. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This line is probably no longer needed (assuming the changes will only be part of the 0.2.0 release)
Sounds great! Thank you for taking a look at this and fixing it so quickly! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
agree that if http allows it, we should support it. and your solution looks fine.
not sure i understand your point about moving the first parameter into the options. are you saying the name is optional? i feel like the name is more than an option, so we should keep it separate. we could switch $resource and $name and have a $name=null. but not sure if we need to do that, people can just pass '' as name, or a random hash.
I agree with you. I just wanted to mention that one could remove the first parameter because it is redundant and not strictly needed. But I think we should keep it since it is way more convenient and covers 99% of the cases. I expect it to be an edge case to configure your own headers. |
This will fix issue #31