reqwestRequest.js 950B

123456789101112131415161718192021222324252627282930
  1. /*!
  2. * Copyright (c) 2015-2016, Okta, Inc. and/or its affiliates. All rights reserved.
  3. * The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the "License.")
  4. *
  5. * You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.
  6. * Unless required by applicable law or agreed to in writing, software
  7. * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
  8. * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  9. *
  10. * See the License for the specific language governing permissions and limitations under the License.
  11. */
  12. var reqwest = require('reqwest');
  13. function reqwestRequest(method, url, args) {
  14. var r = reqwest({
  15. url: url,
  16. method: method,
  17. headers: args.headers,
  18. data: JSON.stringify(args.data),
  19. withCredentials: true
  20. })
  21. .then(function() {
  22. return r.request;
  23. });
  24. return r;
  25. }
  26. module.exports = reqwestRequest;