SHARE
TWEET

Untitled

a guest Aug 23rd, 2019 72 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top