How to use the postman-collection.RequestAuth 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
req.removeQueryParams(qpDef); // $ExpectType void

req.toJSON(); // $ExpectType RequestDefinition

req.clone(); // $ExpectType Request

pmCollection.Request.isRequest(req); // $ExpectType boolean

// RequestAuthDefinition Tests

const reqAuthDef: pmCollection.RequestAuthDefinition = {};
reqAuthDef.type; // $ExpectType string | undefined

// RequestAuth Tests

let reqAuth = new pmCollection.RequestAuth(reqAuthDef);
reqAuth = new pmCollection.RequestAuth(reqAuthDef, collection);

reqAuth.type; // $ExpectType string

reqAuth.update(new pmCollection.VariableList(collection, [])); // $ExpectType void
reqAuth.update({key: "string", value: "string"}); // $ExpectType void
reqAuth.update([{key: "string", value: "string"}]); // $ExpectType void
reqAuth.update([{key: "string", value: "string"}], "string"); // $ExpectType void

reqAuth.use("string", new pmCollection.VariableList(collection, [])); // $ExpectType void
reqAuth.use("string", {key: "string", value: "string"}); // $ExpectType void
reqAuth.use("string", [{key: "string", value: "string"}]); // $ExpectType void

reqAuth.current(); // $ExpectType any

reqAuth.parameters(); // $ExpectType VariableList
github DefinitelyTyped / DefinitelyTyped / types / postman-collection / postman-collection-tests.ts View on Github external
req.toJSON(); // $ExpectType RequestDefinition

req.clone(); // $ExpectType Request

pmCollection.Request.isRequest(req); // $ExpectType boolean

// RequestAuthDefinition Tests

const reqAuthDef: pmCollection.RequestAuthDefinition = {};
reqAuthDef.type; // $ExpectType string | undefined

// RequestAuth Tests

let reqAuth = new pmCollection.RequestAuth(reqAuthDef);
reqAuth = new pmCollection.RequestAuth(reqAuthDef, collection);

reqAuth.type; // $ExpectType string

reqAuth.update(new pmCollection.VariableList(collection, [])); // $ExpectType void
reqAuth.update({key: "string", value: "string"}); // $ExpectType void
reqAuth.update([{key: "string", value: "string"}]); // $ExpectType void
reqAuth.update([{key: "string", value: "string"}], "string"); // $ExpectType void

reqAuth.use("string", new pmCollection.VariableList(collection, [])); // $ExpectType void
reqAuth.use("string", {key: "string", value: "string"}); // $ExpectType void
reqAuth.use("string", [{key: "string", value: "string"}]); // $ExpectType void

reqAuth.current(); // $ExpectType any

reqAuth.parameters(); // $ExpectType VariableList
github postmanlabs / postman-runtime / lib / runner / extensions / request.command.js View on Github external
payload.globals.values
            ],
            item,
            auth;

        // @todo - no need to sync variables when SDK starts supporting resolution from scope directly
        item = context.item = new sdk.Item(context.item.toObjectResolved(null,
            variableDefinitions, {ignoreOwnVariables: true}));

        auth = context.auth;

        // Re-parse the URL, because variables have been resolved now, and things might be moved around
        item.request.url = new (sdk.Url)(item.request.url.toString());

        // resolve variables in auth
        auth && (context.auth = new sdk.RequestAuth(auth.toObjectResolved(null,
            variableDefinitions, {ignoreOwnVariables: true})));
    };
github postmanlabs / openapi-to-postman / lib / util.js View on Github external
description: operation.description,
        url: displayUrl || baseUrl,
        name: reqName,
        method: operationItem.method.toUpperCase()
      }
    });

    // using the auth helper
    authMeta = operation['x-postman-meta'];
    if (authMeta && authMeta.currentHelper && authMap[authMeta.currentHelper]) {
      let thisAuthObject = {
        type: authMap[authMeta.currentHelper]
      };

      thisAuthObject[authMap[authMeta.currentHelper]] = authMeta.helperAttributes;
      item.request.auth = new sdk.RequestAuth(thisAuthObject);
    }
    // TODO: Figure out what happens if type!=api-key
    else if (authHelper && authHelper.type === 'api-key') {
      if (authHelper.properties.in === 'header') {
        item.request.addHeader(this.convertToPmHeader(authHelper.properties));
        item.request.auth = {
          type: 'noauth'
        };
      }
      else if (authHelper.properties.in === 'query') {
        this.convertToPmQueryParameters(authHelper.properties).forEach((pmParam) => {
          item.request.url.addQueryParams(pmParam);
        });
        item.request.auth = {
          type: 'noauth'
        };