SHARE
TWEET

Untitled

a guest Dec 6th, 2019 77 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.   [HttpGet]
  2.         [Route("CallWebhook")]
  3.         public HttpResponseMessage CallWebhook()
  4.         {
  5.             HttpResponseMessage _response = new HttpResponseMessage();
  6.             CustomTraceLog log = new CustomTraceLog();
  7.  
  8.             try
  9.             {
  10.                 using (log.LogScope("Callwebhook() called at qtool API. Content:"))
  11.                 {
  12.                     log.AddLine("Decoding request...");
  13.                     var content = this.GetDocumentContents(HttpContext.Current.Request);
  14.                     log.AddLine(content);
  15.                    
  16.                     using (log.LogScope("building response..."))
  17.                     {
  18.                         var headers = HttpContext.Current.Request.Headers;
  19.                         if (headers.AllKeys.Contains("X-Hook-Secret"))
  20.                         {
  21.                             log.AddLine("X-Hook-Secret found among headers...");
  22.                             var key = headers.Get("X-Hook-Secret");
  23.                             _response.Headers.Add("X-Hook-Secret", key.ToString());
  24.                             _response.StatusCode = HttpStatusCode.OK;
  25.                         }
  26.                         else
  27.                         {
  28.                             log.AddLine("X-Hook-Secret not found among headers");
  29.                         }
  30.                     }
  31.                 }
  32.             }
  33.             catch (Exception e)
  34.             {
  35.                 log.AddException(e);
  36.                 Logger.Log(e, log.ToString());
  37.             }
  38.  
  39.             Logger.Log(LogCategoryAndTitle.UserAction__ApiQTool_Called, log.ToString(), null, null);
  40.  
  41.             return _response;
  42.         }
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
 
Top