Skip to content
New issue

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

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

Already on GitHub? # to your account

Change 'format' option behavior #271

Merged
merged 1 commit into from
Oct 6, 2020

Conversation

Zaphell
Copy link
Contributor

@Zaphell Zaphell commented Oct 6, 2020

Relates to: #268 (PR) and #264 (issue)

Problem

I ran into some problems when doing Bulk API 2.0 operations. Basically, the 'format' needs to be set to 'none' for receiving CSV payloads from the 'failedResults' and 'successfulResults' endpoints. However, you want to make a subsequent 'json' request, the $this->options['format'] !== $this->settings['defaults']['format'] line will prevent you from setting your format to 'json' if it is also the default in the config file (which it might be for most people).

Solution

Instead of the code "remembering" what format you set in your last call, I think it's simpler to always check and set the correct format: If the 'format' option is specified, use that. If it's not specified, use the default from the config file.
To alleviate this, I modified setFormatter() to only set a format if it's different from the current format.

…n't set formatter if correct one is already set.
@omniphx
Copy link
Owner

omniphx commented Oct 6, 2020

Thanks!

@omniphx omniphx merged commit 03bc2ac into omniphx:master Oct 6, 2020
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants