Skip to content

Commit

Permalink
fix(conditions): prevent type updates
Browse files Browse the repository at this point in the history
  • Loading branch information
trieloff committed Dec 18, 2020
1 parent 398593a commit 9a0aa17
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -967,6 +967,7 @@ class Fastly {
*/
async updateCondition(version, name, data) {
const mydata = { ...data };
// cannot change type of condition
delete mydata.type;
return this.request.put(`/service/${this.service_id}/version/${await this.getVersion(version, 'current')}/condition/${encodeURIComponent(name)}`, data);
}
Expand Down Expand Up @@ -1196,7 +1197,9 @@ class Fastly {
* @returns {Promise} The response object representing the completion or failure.
*/
async updateSnippet(version, name, data) {
return this.request.put(`/service/${this.service_id}/version/${await this.getVersion(version, 'current')}/snippet/${name}`, data);
const mydata = { ...data };
delete mydata.type;
return this.request.put(`/service/${this.service_id}/version/${await this.getVersion(version, 'current')}/snippet/${name}`, mydata);
}

/**
Expand Down

0 comments on commit 9a0aa17

Please sign in to comment.