Merge pull request #27971 from takoyaki9n/master

Change the type of URLFetchRequestOptions.payload from string to Object
This commit is contained in:
Ron Buckton
2018-08-09 17:38:25 -07:00
committed by GitHub
2 changed files with 14 additions and 2 deletions

View File

@@ -25,3 +25,14 @@ function createAndSendDocument() {
// Regression
ScriptApp.getService().getUrl();
CalendarApp.GuestStatus.NO;
// test for URLFetchRequestOptions.payload
import URLFetchRequestOptions = GoogleAppsScript.URL_Fetch.URLFetchRequestOptions;
const postTest = (payload: Object): string => {
const url = 'http://httpbin.org/post';
const params: URLFetchRequestOptions = {
method: 'post',
payload: payload
};
return UrlFetchApp.fetch(url, params).getContentText();
};

View File

@@ -1,6 +1,7 @@
// Type definitions for Google Apps Script 2018-07-11
// Type definitions for Google Apps Script 2018-08-08
// Project: https://developers.google.com/apps-script/
// Definitions by: motemen <https://github.com/motemen/>
// takoyaki9n <https://github.com/takoyaki9n>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference path="google-apps-script.types.d.ts" />
@@ -47,7 +48,7 @@ declare namespace GoogleAppsScript {
* payload. It can be a string, a byte array, or a JavaScript object. A JavaScript object will be
* interpretted as a map of form field names to values, where the values can be either strings or blobs.
*/
payload?: string;
payload?: string | object | Base.Blob;
/**
* Deprecated. This instructs fetch to resolve the specified URL within the intranet linked to your