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

fix: ensure an empty array request parameter is stringified and passed through #474

Closed
wants to merge 1 commit into from

Conversation

jgravois
Copy link
Contributor

i'm working on a web component that updates user tags and noticed this afternoon that we currently don't pass a value at all when an empty array is provided as a request parameter.

request(updateUserUrl, {
  params: { tags: [] }, 
  authentication
});

no tags

ArcGIS Online's (understandable) reaction to this call is to make no edits to the user's current tags, when in actuality I want to remove them all.

AFFECTS PACKAGES:
@esri/arcgis-rest-request

AFFECTS PACKAGES:
@esri/arcgis-rest-request
@codecov
Copy link

codecov bot commented Feb 28, 2019

Codecov Report

Merging #474 into master will not change coverage.
The diff coverage is 100%.

Impacted file tree graph

@@          Coverage Diff          @@
##           master   #474   +/-   ##
=====================================
  Coverage     100%   100%           
=====================================
  Files          94     94           
  Lines        1209   1210    +1     
  Branches      219    220    +1     
=====================================
+ Hits         1209   1210    +1
Impacted Files Coverage Δ
...es/arcgis-rest-request/src/utils/process-params.ts 100% <100%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 8f94d82...f8baedc. Read the comment docs.

@jgravois
Copy link
Contributor Author

jgravois commented Feb 28, 2019

huh, it turns out this isn't the right thing to do at all.

i should have been using the optional clearEmptyFields parameter instead.

@jgravois jgravois closed this Feb 28, 2019
@jgravois
Copy link
Contributor Author

jgravois commented Feb 28, 2019

wow.

clearEmptyFields only works on string fields. apparently you're supposed to clear a user's current tags like this:

tags: [","]
// or
tags: ","

¯\(ツ)

@jgravois jgravois deleted the fix/empty-array-params branch February 28, 2019 23:33
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.

1 participant