Skip to content

Commit

Permalink
fix: default to GET when fetching attachments
Browse files Browse the repository at this point in the history
AFFECTS PACKAGES:
@esri/arcgis-rest-feature-layer
  • Loading branch information
jgravois committed May 2, 2019
1 parent 4576dc3 commit b6d746c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
9 changes: 7 additions & 2 deletions packages/arcgis-rest-feature-layer/src/getAttachments.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,14 @@ export interface IAttachmentInfo {
export function getAttachments(
requestOptions: IGetAttachmentsOptions
): Promise<{ attachmentInfos: IAttachmentInfo[] }> {
const options: IGetAttachmentsOptions = {
httpMethod: "GET",
...requestOptions
};

// pass through
return request(
`${cleanUrl(requestOptions.url)}/${requestOptions.featureId}/attachments`,
requestOptions
`${cleanUrl(options.url)}/${options.featureId}/attachments`,
options
);
}
3 changes: 1 addition & 2 deletions packages/arcgis-rest-feature-layer/test/attachments.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,7 @@ describe("attachment methods", () => {
featureId: 42,
params: {
gdbVersion: "SDE.DEFAULT"
},
httpMethod: "GET"
}
} as IGetAttachmentsOptions;
fetchMock.once("*", getAttachmentsResponse);
getAttachments(requestOptions)
Expand Down

0 comments on commit b6d746c

Please sign in to comment.