From 226404d39ce4cec1c3bb7d5043253ab264661923 Mon Sep 17 00:00:00 2001 From: Sergey Lyubka Date: Mon, 13 Dec 2021 15:08:05 +0000 Subject: [PATCH] Example for mg_http_bauth --- docs/README.md | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/docs/README.md b/docs/README.md index 50da8b0e..80169c59 100644 --- a/docs/README.md +++ b/docs/README.md @@ -1236,10 +1236,18 @@ Parameters: Return value: None -Usage example: +Usage example which uses Basic auth to create Stripe subscription: ```c -mg_http_bauth(c, "user_name", "password") // "user_name:password" is now in output buffer + mg_printf(c, "POST /v1/subscriptions HTTP/1.1\r\n" + "Host: api.stripe.com\r\n" + "Transfer-Encoding: chunked\r\n"); + mg_http_bauth(c, stripe_private_key, NULL); // Add Basic auth header + mg_printf(c, "%s", "\r\n"); // End HTTP headers + + mg_http_printf_chunk(c, "&customer=%s", customer_id); // Set customer + mg_http_printf_chunk(c, "&items[0][price]=%s", price); // And price + mg_http_printf_chunk(c, ""); ``` ### mg\_http\_next\_multipart()