question

AasthaSingh-5854 avatar image
0 Votes"
AasthaSingh-5854 asked ·

WebHook testing with GitHub

In the below mentioned link (https://docs.microsoft.com/en-us/learn/modules/monitor-github-events-with-a-function-triggered-by-a-webhook/5-exercise-setup-webhook-for-github-repo) it says that the message generated will be "The webhook will indicate that the message was not processed correctly; it will generate an HTTP 400 error."
But it doesn't gives HTTP error 400 , rather it gives 200 as a result but at the same time mentions that the request was missing "name" as a input . 77425-mslearn.png

azure-functions
mslearn.png (42.0 KiB)
10 |1000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

MayankBargali-MSFT avatar image
1 Vote"
MayankBargali-MSFT answered ·

Hi @AasthaSingh-5854

Welcome to Microsoft Q&A! Thanks for posting the question.

MS Learn is currently not supported in Microsoft Q&A. I have looked into the module and as per the function app code if you are not passing the name in the query string or the request body then the function will return 200 response along with the message that you have received. Looks like there is a content issue in the note. You can always navigate to the end of your page and click on reporting an issue to report this issue. I have reported this issue to the MS Learn team following the Report an Issue link. Let me know if you have any queries or concerns.

 module.exports = async function (context, req) {
     context.log('JavaScript HTTP trigger function processed a request.');
    
     const name = (req.query.name || (req.body && req.body.name));
     const responseMessage = name
         ? "Hello, " + name + ". This HTTP triggered function executed successfully."
         : "This HTTP triggered function executed successfully. Pass a name in the query string or in the request body for a personalized response.";
    
     context.res = {
         // status: 200, /* Defaults to 200 */
         body: responseMessage
     };
 }

77645-image.png


Please 'Accept as answer' and ‘Upvote’ if it helped so that it can help others in the community looking for help on similar topics.


image.png (22.4 KiB)
· 1 ·
10 |1000 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.