Skip to content

Commit 70500a1

Browse files
authored
Drop gzipped option when uploading attachments (#2188)
1 parent d68724e commit 70500a1

File tree

3 files changed

+2
-26
lines changed

3 files changed

+2
-26
lines changed

Diff for: src/http/collection.ts

-3
Original file line numberDiff line numberDiff line change
@@ -445,7 +445,6 @@ export default class Collection {
445445
* @param {Number} [options.last_modified] The last_modified option.
446446
* @param {Object} [options.permissions] The permissions option.
447447
* @param {String} [options.filename] Force the attachment filename.
448-
* @param {String} [options.gzipped] Force the attachment to be gzipped or not.
449448
* @return {Promise<Object, Error>}
450449
*/
451450
@capable(["attachments"])
@@ -459,7 +458,6 @@ export default class Collection {
459458
last_modified?: number;
460459
permissions?: { [key in Permission]?: string[] };
461460
filename?: string;
462-
gzipped?: boolean;
463461
} = {}
464462
): Promise<
465463
KintoResponse<{
@@ -477,7 +475,6 @@ export default class Collection {
477475
{
478476
last_modified,
479477
filename: options.filename,
480-
gzipped: options.gzipped,
481478
headers: this._getHeaders(options),
482479
safe: this._getSafe(options),
483480
}

Diff for: src/http/requests.ts

+2-7
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ interface RequestOptions {
55
safe?: boolean;
66
headers?: Headers | Record<string, string> | string[][];
77
method?: HttpMethod;
8-
gzipped?: boolean | null;
98
last_modified?: number;
109
patch?: boolean;
1110
}
@@ -159,19 +158,15 @@ export function addAttachmentRequest(
159158
{ data, permissions }: RecordRequestBody = {},
160159
options: AddAttachmentRequestOptions = {}
161160
): KintoRequest {
162-
const { headers, safe, gzipped } = { ...requestDefaults, ...options };
161+
const { headers, safe } = { ...requestDefaults, ...options };
163162
const { last_modified } = { ...data, ...options };
164163

165164
const body = { data, permissions };
166165
const formData = createFormData(dataURI, body, options);
167166

168-
const customPath = `${path}${
169-
gzipped !== null ? "?gzipped=" + (gzipped ? "true" : "false") : ""
170-
}`;
171-
172167
return {
173168
method: "POST",
174-
path: customPath,
169+
path,
175170
headers: { ...headers, ...safeHeader(safe, last_modified) },
176171
body: formData,
177172
};

Diff for: test/http/requests_test.ts

-16
Original file line numberDiff line numberDiff line change
@@ -228,21 +228,5 @@ describe("requests module", () => {
228228
.to.have.property("If-Match")
229229
.eql('"42"');
230230
});
231-
232-
it("should support a gzipped option passed with true", () => {
233-
expect(
234-
requests.addAttachmentRequest("/foo", dataURL, {}, { gzipped: true })
235-
)
236-
.to.have.property("path")
237-
.eql("/foo?gzipped=true");
238-
});
239-
240-
it("should support a gzipped option passed with false", () => {
241-
expect(
242-
requests.addAttachmentRequest("/foo", dataURL, {}, { gzipped: false })
243-
)
244-
.to.have.property("path")
245-
.eql("/foo?gzipped=false");
246-
});
247231
});
248232
});

0 commit comments

Comments
 (0)