Advertisement
Guest User

Untitled

a guest
Aug 23rd, 2019
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.72 KB | None | 0 0
  1. function needleObservable(path: string, originalRequest: functions.Request, body: any): Observable<void | NeedleResponse> {
  2.  
  3. const options: NeedleOptions = {
  4. headers: {
  5. date: originalRequest.headers.date,
  6. authorization: originalRequest.headers.authorization
  7. },
  8. rejectUnauthorized: false,
  9. json: false,
  10. content_type: originalRequest.headers["content-type"],
  11. connection: 'close'
  12. };
  13.  
  14. return observableFrom(
  15. needle('post', SERVER_PREFIX + path, body, options)
  16. .then(function(resp) {
  17. return resp;
  18. })
  19. .catch(function(err) {
  20. console.log('Caught error')
  21. console.error(err);
  22. })
  23. );
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement