How to use the postman-collection.Header function in postman-collection

To help you get started, we’ve selected a few postman-collection examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github DefinitelyTyped / DefinitelyTyped / types / postman-collection / postman-collection-tests.ts View on Github external
// HeaderDefinition Tests

const headerDef: pmCollection.HeaderDefinition = {
    key: "string",
    value: "string"
};
headerDef.key; // $ExpectType string | undefined
headerDef.value; // $ExpectType string | undefined
headerDef.system; // $ExpectType boolean | undefined

// Header Tests

let header = new pmCollection.Header("string");
header = new pmCollection.Header("string", "string");
header = new pmCollection.Header(headerDef);

header.key; // $ExpectType string
header.value; // $ExpectType string

header.toString(); // $ExpectType string

header.update(headerDef); // $ExpectType void

header.valueOf(); // $ExpectType string

pmCollection.Header.create("string"); // $ExpectType Header
pmCollection.Header.create("string", "string"); // $ExpectType Header
pmCollection.Header.create(headerDef, "string"); // $ExpectType Header

pmCollection.Header.isHeader(header); // $ExpectType boolean
github DefinitelyTyped / DefinitelyTyped / types / postman-collection / postman-collection-tests.ts View on Github external
fp.toString(); // $ExpectType string
fp.valueOf(); // $ExpectType any

// HeaderDefinition Tests

const headerDef: pmCollection.HeaderDefinition = {
    key: "string",
    value: "string"
};
headerDef.key; // $ExpectType string | undefined
headerDef.value; // $ExpectType string | undefined
headerDef.system; // $ExpectType boolean | undefined

// Header Tests

let header = new pmCollection.Header("string");
header = new pmCollection.Header("string", "string");
header = new pmCollection.Header(headerDef);

header.key; // $ExpectType string
header.value; // $ExpectType string

header.toString(); // $ExpectType string

header.update(headerDef); // $ExpectType void

header.valueOf(); // $ExpectType string

pmCollection.Header.create("string"); // $ExpectType Header
pmCollection.Header.create("string", "string"); // $ExpectType Header
pmCollection.Header.create(headerDef, "string"); // $ExpectType Header
github DefinitelyTyped / DefinitelyTyped / types / postman-collection / postman-collection-tests.ts View on Github external
fp.valueOf(); // $ExpectType any

// HeaderDefinition Tests

const headerDef: pmCollection.HeaderDefinition = {
    key: "string",
    value: "string"
};
headerDef.key; // $ExpectType string | undefined
headerDef.value; // $ExpectType string | undefined
headerDef.system; // $ExpectType boolean | undefined

// Header Tests

let header = new pmCollection.Header("string");
header = new pmCollection.Header("string", "string");
header = new pmCollection.Header(headerDef);

header.key; // $ExpectType string
header.value; // $ExpectType string

header.toString(); // $ExpectType string

header.update(headerDef); // $ExpectType void

header.valueOf(); // $ExpectType string

pmCollection.Header.create("string"); // $ExpectType Header
pmCollection.Header.create("string", "string"); // $ExpectType Header
pmCollection.Header.create(headerDef, "string"); // $ExpectType Header

pmCollection.Header.isHeader(header); // $ExpectType boolean
github postmanlabs / openapi-to-postman / lib / util.js View on Github external
}
      else {
        fakeData = safeSchemaFaker(header.schema || {}, this.components, SCHEMA_FORMATS.DEFAULT);

        // for schema.type=string or number,
        // adding JSON.stringify will add unnecessary extra double quotes around the value
        if (header.schema && (header.schema.type === 'object')) {
          fakeData = JSON.stringify(fakeData);
        }
      }
    }
    else {
      fakeData = '';
    }

    reqHeader = new sdk.Header({
      key: header.name,
      value: fakeData
    });
    reqHeader.description = header.description;

    return reqHeader;
  },
github postmanlabs / openapi-to-postman / lib / util.js View on Github external
if (contentObj.hasOwnProperty(cType)) {
            bodyType = cType;
            break;
          }
        }
      }

      bodyData = this.convertToPmBodyData(contentObj[bodyType], bodyType,
        BODY_TYPE.REQUEST, this.options.indentCharacter);

      updateOptions = {
        mode: rDataMode,
        raw: JSON.stringify(bodyData, null, 4)
      };

      contentHeader = new sdk.Header({
        key: 'Content-Type',
        value: bodyType
      });

      reqBody.update(updateOptions);
    }

    return {
      body: reqBody,
      contentHeader: contentHeader,
      formHeaders: formHeaders
    };
  },