[svn-commits] dlee: branch dlee/ASTERISK-22685-json-body r402454 - in /team/dlee/ASTERISK-2...

SVN commits to the Digium repositories svn-commits at lists.digium.com
Mon Nov 4 15:07:48 CST 2013


Author: dlee
Date: Mon Nov  4 15:07:46 2013
New Revision: 402454

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=402454
Log:
Removed dummy app for testing body params

Modified:
    team/dlee/ASTERISK-22685-json-body/res/ari/resource_asterisk.c
    team/dlee/ASTERISK-22685-json-body/res/ari/resource_asterisk.h
    team/dlee/ASTERISK-22685-json-body/res/res_ari_asterisk.c
    team/dlee/ASTERISK-22685-json-body/rest-api/api-docs/asterisk.json

Modified: team/dlee/ASTERISK-22685-json-body/res/ari/resource_asterisk.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/ASTERISK-22685-json-body/res/ari/resource_asterisk.c?view=diff&rev=402454&r1=402453&r2=402454
==============================================================================
--- team/dlee/ASTERISK-22685-json-body/res/ari/resource_asterisk.c (original)
+++ team/dlee/ASTERISK-22685-json-body/res/ari/resource_asterisk.c Mon Nov  4 15:07:46 2013
@@ -36,18 +36,6 @@
 #include "asterisk/paths.h"
 #include "asterisk/pbx.h"
 #include "resource_asterisk.h"
-
-void ast_ari_asterisk_echo(struct ast_variable *headers,
-	struct ast_asterisk_echo_args *args,
-	struct ast_ari_response *response)
-{
-	if (!args->anything) {
-		ast_ari_response_error(response, 400, "Bad Request",
-			"Missing request body");
-		return;
-	}
-	ast_ari_response_ok(response, ast_json_ref(args->anything));
-}
 
 void ast_ari_get_asterisk_info(struct ast_variable *headers,
 	struct ast_get_asterisk_info_args *args,

Modified: team/dlee/ASTERISK-22685-json-body/res/ari/resource_asterisk.h
URL: http://svnview.digium.com/svn/asterisk/team/dlee/ASTERISK-22685-json-body/res/ari/resource_asterisk.h?view=diff&rev=402454&r1=402453&r2=402454
==============================================================================
--- team/dlee/ASTERISK-22685-json-body/res/ari/resource_asterisk.h (original)
+++ team/dlee/ASTERISK-22685-json-body/res/ari/resource_asterisk.h Mon Nov  4 15:07:46 2013
@@ -39,19 +39,6 @@
 
 #include "asterisk/ari.h"
 
-/*! \brief Argument struct for ast_ari_asterisk_echo() */
-struct ast_asterisk_echo_args {
-	/*! \brief Content to echo back */
-	struct ast_json *anything;
-};
-/*!
- * \brief Returns your input.
- *
- * \param headers HTTP headers
- * \param args Swagger parameters
- * \param[out] response HTTP response
- */
-void ast_ari_asterisk_echo(struct ast_variable *headers, struct ast_asterisk_echo_args *args, struct ast_ari_response *response);
 /*! \brief Argument struct for ast_ari_get_asterisk_info() */
 struct ast_get_asterisk_info_args {
 	/*! \brief Array of Filter information returned */

Modified: team/dlee/ASTERISK-22685-json-body/res/res_ari_asterisk.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/ASTERISK-22685-json-body/res/res_ari_asterisk.c?view=diff&rev=402454&r1=402453&r2=402454
==============================================================================
--- team/dlee/ASTERISK-22685-json-body/res/res_ari_asterisk.c (original)
+++ team/dlee/ASTERISK-22685-json-body/res/res_ari_asterisk.c Mon Nov  4 15:07:46 2013
@@ -51,75 +51,6 @@
 
 #define MAX_VALS 128
 
-/*!
- * \brief Parameter parsing callback for /asterisk/echo.
- * \param get_params GET parameters in the HTTP request.
- * \param path_vars Path variables extracted from the request.
- * \param headers HTTP headers.
- * \param[out] response Response to the HTTP request.
- */
-static void ast_ari_asterisk_echo_cb(
-	struct ast_tcptls_session_instance *ser,
-	struct ast_variable *get_params, struct ast_variable *path_vars,
-	struct ast_variable *headers, struct ast_ari_response *response)
-{
-	struct ast_asterisk_echo_args args = {};
-	RAII_VAR(struct ast_json *, body, NULL, ast_json_unref);
-#if defined(AST_DEVMODE)
-	int is_valid;
-	int code;
-#endif /* AST_DEVMODE */
-
-
-	/* Look for a JSON request entity */
-	body = ast_http_get_json(ser, headers);
-	if (!body) {
-		switch (errno) {
-		case EFBIG:
-			ast_ari_response_error(response, 413, "Request Entity Too Large", "Request body too large");
-			goto fin;
-		case ENOMEM:
-			ast_ari_response_error(response, 500, "Internal Server Error", "Error processing request");
-			goto fin;
-		case EIO:
-			ast_ari_response_error(response, 400, "Bad Request", "Error parsing request body");
-			goto fin;
-		}
-	}
-	args.anything = ast_json_ref(body);
-	ast_ari_asterisk_echo(headers, &args, response);
-#if defined(AST_DEVMODE)
-	code = response->response_code;
-
-	switch (code) {
-	case 0: /* Implementation is still a stub, or the code wasn't set */
-		is_valid = response->message == NULL;
-		break;
-	case 500: /* Internal Server Error */
-	case 501: /* Not Implemented */
-	case 400: /* Missing request body */
-		is_valid = 1;
-		break;
-	default:
-		if (200 <= code && code <= 299) {
-			is_valid = ast_ari_validate_object(
-				response->message);
-		} else {
-			ast_log(LOG_ERROR, "Invalid error response %d for /asterisk/echo\n", code);
-			is_valid = 0;
-		}
-	}
-
-	if (!is_valid) {
-		ast_log(LOG_ERROR, "Response validation failed for /asterisk/echo\n");
-		ast_ari_response_error(response, 500,
-			"Internal Server Error", "Response validation failed");
-	}
-#endif /* AST_DEVMODE */
-
-fin: __attribute__((unused))
-	return;
-}
 /*!
  * \brief Parameter parsing callback for /asterisk/info.
  * \param get_params GET parameters in the HTTP request.
@@ -432,15 +363,6 @@
 	return;
 }
 
-/*! \brief REST handler for /api-docs/asterisk.{format} */
-static struct stasis_rest_handlers asterisk_echo = {
-	.path_segment = "echo",
-	.callbacks = {
-		[AST_HTTP_POST] = ast_ari_asterisk_echo_cb,
-	},
-	.num_children = 0,
-	.children = {  }
-};
 /*! \brief REST handler for /api-docs/asterisk.{format} */
 static struct stasis_rest_handlers asterisk_info = {
 	.path_segment = "info",
@@ -465,8 +387,8 @@
 	.path_segment = "asterisk",
 	.callbacks = {
 	},
-	.num_children = 3,
-	.children = { &asterisk_echo,&asterisk_info,&asterisk_variable, }
+	.num_children = 2,
+	.children = { &asterisk_info,&asterisk_variable, }
 };
 
 static int load_module(void)

Modified: team/dlee/ASTERISK-22685-json-body/rest-api/api-docs/asterisk.json
URL: http://svnview.digium.com/svn/asterisk/team/dlee/ASTERISK-22685-json-body/rest-api/api-docs/asterisk.json?view=diff&rev=402454&r1=402453&r2=402454
==============================================================================
--- team/dlee/ASTERISK-22685-json-body/rest-api/api-docs/asterisk.json (original)
+++ team/dlee/ASTERISK-22685-json-body/rest-api/api-docs/asterisk.json Mon Nov  4 15:07:46 2013
@@ -7,33 +7,6 @@
 	"basePath": "http://localhost:8088/stasis",
 	"resourcePath": "/api-docs/asterisk.{format}",
 	"apis": [
-		{
-			"path": "/asterisk/echo",
-			"description": "Resource to test body parameters",
-			"operations": [
-				{
-					"httpMethod": "POST",
-					"summary": "Returns your input.",
-					"nickname": "asteriskEcho",
-					"responseClass": "object",
-					"parameters": [
-						{
-							"name": "anything",
-							"description": "Content to echo back",
-							"paramType": "body",
-							"required": true,
-							"dataType": "object"
-						}
-					],
-					"errorResponses": [
-						{
-							"code": 400,
-							"reason": "Missing request body"
-						}
-					]
-				}
-			]
-		},
 		{
 			"path": "/asterisk/info",
 			"description": "Asterisk system information (similar to core show settings)",




More information about the svn-commits mailing list