Example #1
0
void StoreApiStoreOrderOrderIdResource::DELETE_method_handler(const std::shared_ptr<restbed::Session> session) {

	const auto request = session->get_request();
			
			// Getting the path params
			const std::string orderId = request->get_path_parameter("orderId", "");
			

			
			// Change the value of this variable to the appropriate response before sending the response
			int status_code = 200;
			
			/**
			 * Process the received information here
			 */
			
			if (status_code == 400) {
				session->close(400, "Invalid ID supplied", { {"Connection", "close"} });
				return;
			}
			if (status_code == 404) {
				session->close(404, "Order not found", { {"Connection", "close"} });
				return;
			}

}
Example #2
0
static void RPCAcceptHandler(std::shared_ptr< basic_socket_acceptor<Protocol, SocketAcceptorService> > acceptor,
                             ssl::context& context,
                             const bool fUseSSL,
                             std::shared_ptr< AcceptedConnection > conn,
                             const boost::system::error_code& error)
{
    // Immediately start accepting new connections, except when we're cancelled or our socket is closed.
    if (error != asio::error::operation_aborted && acceptor->is_open())
        RPCListen(acceptor, context, fUseSSL);

    AcceptedConnectionImpl<ip::tcp>* tcp_conn = dynamic_cast< AcceptedConnectionImpl<ip::tcp>* >(conn.get());

    if (error)
    {
        // TODO: Actually handle errors
        LogPrint("INFO","%s: Error: %s\n", __func__, error.message());
    }
    // Restrict callers by IP.  It is important to
    // do this before starting client thread, to filter out
    // certain DoS and misbehaving clients.
    else if (tcp_conn && !ClientAllowed(tcp_conn->peer.address()))
    {
        // Only send a 403 if we're not using SSL to prevent a DoS during the SSL handshake.
        if (!fUseSSL)
            conn->stream() << HTTPReply(HTTP_FORBIDDEN, "", false) << flush;
        conn->close();
    }
    else {
        ServiceConnection(conn.get());
        conn->close();
    }
}
Example #3
0
void UserApiUserUsernameResource::GET_method_handler(const std::shared_ptr<restbed::Session> session) {

	const auto request = session->get_request();

			// Getting the path params
			const std::string username = request->get_path_parameter("username", "");
			
		
			
			// Change the value of this variable to the appropriate response before sending the response
			int status_code = 200;
			
			/**
			 * Process the received information here
			 */
			
			if (status_code == 200) {
				std::shared_ptr<User> response = NULL;
				session->close(200, "successful operation", { {"Connection", "close"} });
				return;
			}
			if (status_code == 400) {
				session->close(400, "Invalid username supplied", { {"Connection", "close"} });
				return;
			}
			if (status_code == 404) {
				session->close(404, "User not found", { {"Connection", "close"} });
				return;
			}

}
Example #4
0
void UserApiUserUsernameResource::PUT_method_handler(const std::shared_ptr<restbed::Session> session) {

	const auto request = session->get_request();
	// Body params are present, therefore we have to fetch them
	int content_length = request->get_header("Content-Length", 0);
	session->fetch(content_length,
		[ this ]( const std::shared_ptr<restbed::Session> session, const restbed::Bytes & body )
		{

			const auto request = session->get_request();
			std::string requestBody = restbed::String::format("%.*s\n", ( int ) body.size( ), body.data( ));

			// Getting the path params
			const std::string username = request->get_path_parameter("username", "");
			
		
			
			// Change the value of this variable to the appropriate response before sending the response
			int status_code = 200;
			
			/**
			 * Process the received information here
			 */
			
			if (status_code == 400) {
				session->close(400, "Invalid user supplied", { {"Connection", "close"} });
				return;
			}
			if (status_code == 404) {
				session->close(404, "User not found", { {"Connection", "close"} });
				return;
			}

		});
}
Example #5
0
void UserApiUserLoginResource::GET_method_handler(const std::shared_ptr<restbed::Session> session) {

	const auto request = session->get_request();
			
			
			// Getting the query params
			const std::string username = request->get_query_parameter("username", "");
			const std::string password = request->get_query_parameter("password", "");

			
			// Change the value of this variable to the appropriate response before sending the response
			int status_code = 200;
			
			/**
			 * Process the received information here
			 */
			
			if (status_code == 200) {
				// Description: calls per hour allowed by the user
				session->set_header("X-Rate-Limit", ""); // Change second param to your header value
				// Description: date in UTC when toekn expires
				session->set_header("X-Expires-After", ""); // Change second param to your header value
				session->close(200, "successful operation", { {"Connection", "close"} });
				return;
			}
			if (status_code == 400) {
				session->close(400, "Invalid username/password supplied", { {"Connection", "close"} });
				return;
			}

}
void resource_error_handler(const int, const std::exception&, const std::shared_ptr< Session > session)
{
	if (session->is_open())
	{
		session->close(6000, "Custom Resource Internal Server Error", { { "Content-Length", "37" } });
	}
	else
	{
		session->close();
		fprintf(stderr, "Custom Resource Internal Server Error\n");
	}
}
Example #7
0
void Tunnel::handleConnect(std::shared_ptr<Tunnel> self, std::shared_ptr<ip::tcp::socket> sock0, std::shared_ptr<ip::tcp::socket> sock1, const boost::system::error_code &error) {

   if (error) {
      CERR << "error in connect: " << error.message() << std::endl;
      sock0->close();
      sock1->close();
      return;
   }
   CERR << "connected stream..." << std::endl;
   auto stream = std::make_shared<TunnelStream>(sock0, sock1);
   m_streams.emplace_back(stream);
   stream->start(stream);
}
void service_error_handler(const int, const std::exception& ex, const std::shared_ptr< Session > session)
{
	if (session->is_open())
	{
		cout << ex.what() << endl;
		session->close(5000, "Custom Service Internal Server Error", { { "Content-Length", "36" } });
	}
	else
	{
		session->close();
		fprintf(stderr, "Custom Service Internal Server Error\n");
	}
}
void put_orders_num_func(const std::shared_ptr< Session > session)
{
	const auto request = session->get_request();

	/*auto ret = request->get_query_parameters();
	for (auto& r : ret)
		cout << r.first << "::::" << r.second << endl;*/
	string cbody = "";
	for (const auto key : session->keys())
	{
		string value = session->get(key);
		cbody += key + ":::::" + value + "\n";
		cout << key <<":::::"<< value<< endl;
	}
	cout << __LINE__ << ":" << cbody << endl;

	size_t content_length = 0;
	request->get_header("Content-Length", content_length);

	session->fetch(content_length, [request](const std::shared_ptr< Session > session, const Bytes & body)
	{
		fprintf(stdout, "%.*s\n", (int)body.size(), body.data());
		//session->close(OK, "Hello, World!", { { "Content-Length", "13" }, { "Connection", "close" } });
	});
	string order_num = session->get_request()->get_path_parameter("name");
	cout << "order_num:" << order_num << endl;
	string body = "{ \"response_code\": 1, \"orderbot_order_id\" : 2, \"reference_order_id\" : null, \"success\" : true, \"message\" : \"Order has been updated successfully!\" }";
	
	session->close(OK, body, { { "Content-Length", ::to_string(body.length()) } });
}
Example #10
0
gl_sarray gl_sarray_writer_impl::close() {
  m_output_iterators.clear();
  m_out_sarray->close();
  auto usarray = std::make_shared<unity_sarray>();
  usarray->construct_from_sarray(m_out_sarray);
  return usarray;
}
Example #11
0
// {{{ Webserver events
bool UPnP::onGet(BaseLib::Rpc::PServerInfo& serverInfo, BaseLib::Http& httpRequest, std::shared_ptr<BaseLib::TcpSocket>& socket, std::string& path)
{
    if(_stopServer) return false;
    if(GD::bl->settings.enableUPnP() && path == "/description.xml")
    {
        std::vector<char> content;
        getDescription(serverInfo->port, content);
        if(!content.empty())
        {
            std::string header;
            std::vector<std::string> additionalHeaders;
            BaseLib::Http::constructHeader(content.size(), "text/xml", 200, "OK", additionalHeaders, header);
            content.insert(content.begin(), header.begin(), header.end());
            try
            {
                //Sleep a tiny little bit. Some clients like don't accept responses too fast.
                std::this_thread::sleep_for(std::chrono::milliseconds(22));
                socket->proofwrite(content);
            }
            catch(BaseLib::SocketDataLimitException& ex)
            {
                _out.printWarning("Warning: " + ex.what());
            }
            catch(const BaseLib::SocketOperationException& ex)
            {
                _out.printError("Error: " + ex.what());
            }
            socket->close();
            return true;
        }
    }
    return false;
}
Example #12
0
void UserApiUserResource::POST_method_handler(const std::shared_ptr<restbed::Session> session) {

	const auto request = session->get_request();
	// Body params are present, therefore we have to fetch them
	int content_length = request->get_header("Content-Length", 0);
	session->fetch(content_length,
		[ this ]( const std::shared_ptr<restbed::Session> session, const restbed::Bytes & body )
		{

			const auto request = session->get_request();
			std::string requestBody = restbed::String::format("%.*s\n", ( int ) body.size( ), body.data( ));
			/**
			 * Get body params or form params here from the requestBody string
			 */
			
			

			
			// Change the value of this variable to the appropriate response before sending the response
			int status_code = 200;
			
			/**
			 * Process the received information here
			 */
			
			if (status_code == 0) {
				session->close(0, "successful operation", { {"Connection", "close"} });
				return;
			}

		});
}
Example #13
0
void WebServer::send(std::shared_ptr<BaseLib::SocketOperations>& socket, std::vector<char>& data)
{
	try
	{
		if(data.empty()) return;
		try
		{
			//Sleep a tiny little bit. Some clients like don't accept responses too fast.
			std::this_thread::sleep_for(std::chrono::milliseconds(22));
			socket->proofwrite(data);
		}
		catch(BaseLib::SocketDataLimitException& ex)
		{
			_out.printWarning("Warning: " + ex.what());
		}
		catch(const BaseLib::SocketOperationException& ex)
		{
			_out.printError("Error: " + ex.what());
		}
		socket->close();
	}
    catch(const std::exception& ex)
    {
    	_out.printEx(__FILE__, __LINE__, __PRETTY_FUNCTION__, ex.what());
    }
    catch(BaseLib::Exception& ex)
    {
    	_out.printEx(__FILE__, __LINE__, __PRETTY_FUNCTION__, ex.what());
    }
    catch(...)
    {
    	_out.printEx(__FILE__, __LINE__, __PRETTY_FUNCTION__);
    }
}
Example #14
0
void I2PControlService::HandleResponseSent(const boost::system::error_code& ecode, std::size_t,
    std::shared_ptr<boost::asio::ip::tcp::socket> socket, std::shared_ptr<I2PControlBuffer>)
{
    if(ecode)
        LogPrint(eLogError, "I2PControl write error: ", ecode.message());
    socket->close();
}
Example #15
0
    TestResult testRmDocNotify()
    {
        _messageReceived.clear();

        // subscribe to rmdoc notification on admin websocket
        const std::string subscribeMessage = "subscribe rmdoc";
        _adminWs->sendFrame(subscribeMessage.data(), subscribeMessage.size());

        _docWs1->close();
        std::unique_lock<std::mutex> lock(_messageReceivedMutex);
        if (_messageReceived.empty() &&
            _messageReceivedCV.wait_for(lock, std::chrono::milliseconds(_messageTimeoutMilliSeconds)) == std::cv_status::timeout)
        {
            Log::info("testRmDocNotify: Timed out waiting for admin console message");
            return TestResult::TEST_TIMED_OUT;
        }
        lock.unlock();

        StringTokenizer tokens(_messageReceived, " ", StringTokenizer::TOK_IGNORE_EMPTY | StringTokenizer::TOK_TRIM);
        if (tokens.count() != 3 ||
            tokens[0] != "rmdoc" ||
            stoi(tokens[1]) != _docPid1)
        {
            Log::info("testRmDocNotify: Invalid message format");
            return TestResult::TEST_FAILED;
        }
        _usersCount--;

        Log::info(std::string("testRmDocNotify: OK"));
        return TestResult::TEST_OK;
    }
void get_products_num_func(const std::shared_ptr< Session > session)
{/*
	stringstream id;
	id << ::this_thread::get_id();
	auto body = String::format("Thread:%s,Password Protected! \n", id.str().data());*/
	string first = "{ \"product_category_id\": 2, \"product_category\": \"Rings\", \"product_group_id\": 4, \"product_group\": \"Bands\", \"product_id\": 469315, \"product_name\": \"TestAPI \", \"sku\": \"testAPI\", \"upc\": \"12345678\", \"cost\": 2, \"descriptive_title\": \"\", \"description\": \"\", \"is_parent\": false,\"parent_id\": 0, \"units_of_measure\": \"Each\", \"taxable\": true, \"shipping_units_of_measure\": \"Lbs\", \"weight\": 1, \"active\": true, \"base_price\": 10, \"lead_times\": null, \"variable_group_id\": 0, \"variable_group_name\": null, \"variable1_id\": 0, \"variable1_name\": null, \"variable_Value1_id\": 0, \"variable_value1_name\": null, \"variable2_id\": 0, \"variable2_name\": null, \"variable_value2_id\": 0, \"variable_value2_name\": null, \"custom_fields\": [], \"tags\": [], \"image_urls\": [], \"visibility_on_webs\": null, \"optional_description_fields\": { \"description1\": \"\", \"description2\": \"\", \"description3\": \"\", \"description4\": \"\", \"description5\": \"\", \"description6\": \"\" } }";
	string order_num = session->get_request()->get_path_parameter("name");
	string body = first;
	session->close(OK, body, { { "Content-Length", ::to_string(body.length()) } });
}
void get_customers_num_func(const std::shared_ptr< Session > session)
{/*
	stringstream id;
	id << ::this_thread::get_id();
	auto body = String::format("Thread:%s,Password Protected! \n", id.str().data());*/
	string first = "{  \"customer_id\": 2,  \"account_id\": 2,  \"customer_name\": \" \",  \"address\": \"555\",  \"address2\": \"\",  \"city\": \"Vancouver\",  \"state\": \"AL\",  \"country\": \"US\",  \"postal_code\": \"90210\",  \"phone\": \"5555555555\",  \"phone_ext\": \"\",  \"sales_rep_id\": null,  \"commission_rate\": 0,  \"email\": \"\",  \"customer_hash_id\": null,  \"other_id\": \"7777777\",  \"active\": true  }";
	string order_num = session->get_request()->get_path_parameter("name");
	string body = first;
	session->close(OK, body, { { "Content-Length", ::to_string(body.length()) } });
}
void get_salesreps_num_func(const std::shared_ptr< Session > session)
{/*
	stringstream id;
	id << ::this_thread::get_id();
	auto body = String::format("Thread:%s,Password Protected! \n", id.str().data());*/
	string first = "{\"sales_rep_id\": 461,\"sales_name\":\"Andrew\",\"commission\": 8,\"email_invoices\":null}";
	string order_num = session->get_request()->get_path_parameter("name");
	string body = first;
	session->close(OK, body, { { "Content-Length", ::to_string(body.length()) } });
}
Example #19
0
    void
    on_write(const std::error_code& ec) {
        if(ec) {
            if(ec == asio::error::operation_aborted) {
                return;
            }

            session->close();
        }
    }
Example #20
0
	void HTTPProxyHandler::Terminate() {
		if (Kill()) return;
		if (m_sock) 
		{
			LogPrint(eLogDebug,"--- HTTP Proxy close sock");
			m_sock->close();
			m_sock = nullptr;
		}
		Done(shared_from_this());
	}
/////////////////regular
void get_orders_num_func(const std::shared_ptr< Session > session)
{/*
	stringstream id;
	id << ::this_thread::get_id();
	auto body = String::format("Thread:%s,Password Protected! \n", id.str().data());*/
	string first = "{ \"order_id\":";
	string last = ", \"customer_po\" : null, \"order_date\" : \"2015-04-16\", \"last_modified\" : \"2015-08-13\", \"ship_date\" : \"2015-04-16\", \"shipping_method\" : \"UPS Ground\", \"order_status\" : \"unshipped\", \"customer_id\" : 1, \"order_tax_total\" : 0, \"shipping_total\" : 0, \"discount_total\" : 0, \"order_total\" : 0, \"notes\" : \"\", \"internal_notes\" : \"\", \"shipping_address\" : {			\"store_name\": null, \"full_name\" : \"John Smith\", \"street1\" : \"123 1st St.\", \"street2\" : \"\", \"city\" : \"San Francisco\", \"state\" : \"CA\", \"postal_code\" : \"11223\", \"country\" : \"US\", \"phone\" : \"5555555555\", \"fax\" : null, \"email\" : \"[email protected]\", Orderbot API				November 23rd, 2015 12				\"website\" : null		}, \"billing_address\" : {				\"sales_channel\": \"DTC\", \"full_name\" : \"John Smith\", \"street1\" : \"123 1st St.\", \"street2\" : \"\", \"city\" : \"San Francisco\", \"state\" : \"CA\", \"postal_code\" : \"11223\", \"country\" : \"US\", \"phone\" : \"5555555555\", \"fax\" : null, \"email\" : \"[email protected]\", \"website\" : null			}, \"payment\" : [{					\"payment_method\": \"Paid From Web\", \"amount_paid\" : 0.1				}, { \"payment_method\": \"VOID\", \"amount_paid\" : -24.96 }, { \"payment_method\": \"Credit\", \"amount_paid\" : 24.96 }, { \"payment_method\": \"Customer Service\", \"amount_paid\" : -0.1 }], \"items\" : [{				\"item_id\": 0, \"product_id\" : 96211, \"sku\" : \"ASDF123\", \"name\" : \"Test Product\", \"quantity\" : 1, \"unit_price\" : 0, \"discount\" : 0, \"product_tax\" : 0, \"product_tax_total\" : 0, \"product_total\" : 0, \"weight\" : 0.5			}], \"tracking_numbers\" : null, \"other_charges\" : null }";
	string order_num = session->get_request()->get_path_parameter("name");
	string body = first + order_num + last;
	session->close(OK, body, { { "Content-Length", ::to_string(body.length()) } });
}
Example #22
0
 std::future<void> OneToManyProcessor::deleteAsync(std::shared_ptr<WebRtcConnection> connection) {
   auto promise = std::make_shared<std::promise<void>>();
   if (connection) {
     connection->getWorker()->task([promise, connection] {
       connection->close();
       promise->set_value();
     });
   } else {
     promise->set_value();
   }
   return promise->get_future();
 }
void get_product_structure_param_func(const std::shared_ptr< Session > session)
{
	/*stringstream id;
	id << ::this_thread::get_id();
	auto body = String::format("Thread:%s,Password Protected! \n", id.str().data());*/

	const auto request = session->get_request();
	auto ret = request->get_query_parameters();
	for (auto& r : ret)
		cout << r.first << ":" << r.second << endl;
	string body = "[ { \"class_type_id\" : 2,\"class_type_name\" : \"Assembly\",\"product_classes\" : [ { \"categories\" : [ ],\"product_class_id\" : 26,\"product_class_name\" : \"Assembly\"},{ \"categories\" : [ ],\"product_class_id\" : 312,\"product_class_name\" : \"Assembly2\"},{ \"categories\" : [ ],\"product_class_id\" : 317,\"product_class_name\" : \"Assembly3\"}]},{ \"class_type_id\" : 1,\"class_type_name\" : \"Component\",\"product_classes\" : [ { \"categories\" : [ { \"category_id\" : 616,\"category_name\" : \"Your category1 \",\"groups\" : [ { \"group_id\" : 2631,\"group_name\" : \"Your group1 \"},{ \"group_id\" : 2632,\"group_name\" : \" Your group2\"}]} ],\"product_class_id\" : 25,\"product_class_name\" : \"Inventory 1\"},{ \"categories\" : [ ],\"product_class_id\" : 83,\"product_class_name\" : \"Inventory 2\"},{ \"categories\" : [ ],\"product_class_id\" : 311,\"product_class_name\" : \"Inventory4\"},{ \"categories\" : [ ],\"product_class_id\" : 315,\"product_class_name\" : \"Inventory5\"}]},{ \"class_type_id\" : 4,\"class_type_name\" : \"Sales\",\"product_classes\" : [ { \"categories\" : [ { \"category_id\" : 1,\"category_name\" : \"Your category1\",\"groups\" : [ { \"group_id\" : 1,\"group_name\" : \"Your group1\"},{ \"group_id\" : 2,\"group_name\" : \"Your group2\"}]},{ \"category_id\" : 2,\"category_name\" : \"Rings\",\"groups\" : [ { \"group_id\" : 3,\"group_name\" : \"With Stones\"},{ \"group_id\" : 4,\"group_name\" : \"Bands\"}]}],\"product_class_id\" : 33,\"product_class_name\" : \"Products\"} ]}]";
	session->close(OK, body, { { "Content-Length", ::to_string(body.length()) } });
}
void get_Countries_param_func(const std::shared_ptr< Session > session)
{
	/*stringstream id;
	id << ::this_thread::get_id();
	auto body = String::format("Thread:%s,Password Protected! \n", id.str().data());*/

	const auto request = session->get_request();
	auto ret = request->get_query_parameters();
	for (auto& r : ret)
		cout << r.first << ":" << r.second << endl;
	string body = "[ { \"country\" : \"Canada\",\"country_id\" : 38,\"iso2\" : \"CA\",\"iso3\" : \"CAN\"},{ \"country\" : \"United States\",\"country_id\" : 226,\"iso2\" : \"US\",\"iso3\" : \"USA\"}]";
	session->close(OK, body, { { "Content-Length", ::to_string(body.length()) } });
}
void get_vendor_purchase_unit_of_measurements_param_func(const std::shared_ptr< Session > session)
{
	/*stringstream id;
	id << ::this_thread::get_id();
	auto body = String::format("Thread:%s,Password Protected! \n", id.str().data());*/

	const auto request = session->get_request();
	auto ret = request->get_query_parameters();
	for (auto& r : ret)
		cout << r.first << ":" << r.second << endl;
	string body = "[ { \"vendor_purchase_unit_of_measurement_id\" : 61,  \"vendor_purchase_unit_of_measurement_name\" : \"Each\"  } ]";
	session->close(OK, body, { { "Content-Length", ::to_string(body.length()) } });
}
void get_websites_param_func(const std::shared_ptr< Session > session)
{
	/*stringstream id;
	id << ::this_thread::get_id();
	auto body = String::format("Thread:%s,Password Protected! \n", id.str().data());*/

	const auto request = session->get_request();
	auto ret = request->get_query_parameters();
	for (auto& r : ret)
		cout << r.first << ":" << r.second << endl;
	string body = "[ { \"Website_Id\" : 35,  \"website_name\" : \"DTC Frontend\"  } ]";
	session->close(OK, body, { { "Content-Length", ::to_string(body.length()) } });
}
void get_distribution_centers_param_func(const std::shared_ptr< Session > session)
{
	/*stringstream id;
	id << ::this_thread::get_id();
	auto body = String::format("Thread:%s,Password Protected! \n", id.str().data());*/

	const auto request = session->get_request();
	auto ret = request->get_query_parameters();
	for (auto& r : ret)
		cout << r.first << ":" << r.second << endl;
	string body = "[ { \"address\" : \"Warehouse address\",\"address2\" : \"\",\"city\" : \"Warehouse city\",\"contact\" : \"warehosue contact\",\"country\" : \"US\",\"distribution_center_id\" : 1,\"distribution_center_name\" : \"Your warehouse\",\"email\" : \"[email protected]\",\"fax\" : \"\",\"phone\" : \"999 - 888 - 7777\",\"postal_code\" : \"11111\",\"state\" : \"AL\",\"website\" : \"\"},{ \"address\" : \"New address \",\"address2\" : \"\",\"city\" : \"New City\",\"contact\" : \"\",\"country\" : \"CA\",\"distribution_center_id\" : 138,\"distribution_center_name\" : \"NEW DC\",\"email\" : \"\",\"fax\" : \"\",\"phone\" : \"\",\"postal_code\" : \"12345\",\"state\" : \"CA\",\"website\" : \"\"}]";
	session->close(OK, body, { { "Content-Length", ::to_string(body.length()) } });
}
void get_States_param_func(const std::shared_ptr< Session > session)
{
	/*stringstream id;
	id << ::this_thread::get_id();
	auto body = String::format("Thread:%s,Password Protected! \n", id.str().data());*/

	const auto request = session->get_request();
	auto ret = request->get_query_parameters();
	for (auto& r : ret)
		cout << r.first << ":" << r.second << endl;
	string body = "[ { \"abbreviation\" : \"AL\",  \"state\" : \"Alabama\",  \"state_id\" : 1  },  { \"abbreviation\" : \"AK\",  \"state\" : \"Alaska\",  \"state_id\" : 2  },  { \"abbreviation\" : \"AZ\",  \"state\" : \"Arizona\",  \"state_id\" : 3  },  { \"abbreviation\" : \"AR\",  \"state\" : \"Arkansas\",  \"state_id\" : 4  }]";
	session->close(OK, body, { { "Content-Length", ::to_string(body.length()) } });
}
void get_product_variables_param_func(const std::shared_ptr< Session > session)
{
	/*stringstream id;
	id << ::this_thread::get_id();
	auto body = String::format("Thread:%s,Password Protected! \n", id.str().data());*/

	const auto request = session->get_request();
	auto ret = request->get_query_parameters();
	for (auto& r : ret)
		cout << r.first << ":" << r.second << endl;
	string body = "[ { \"product_variables\" : [ { \"product_variable_values\" : [ { \"variable_value_id\" : 317,\"variable_value_name\" : \"XS\"},{ \"variable_value_id\" : 318,\"variable_value_name\" : \"S\"},{ \"variable_value_id\" : 319,\"variable_value_name\" : \"M\"},{ \"variable_value_id\" : 320,\"variable_value_name\" : \"L\"},{ \"variable_value_id\" : 321,\"variable_value_name\" : \"XL\"}],\"variable_id\" : 37,\"variable_name\" : \"Sizes\"},{ \"product_variable_values\" : [ { \"variable_value_id\" : 322,\"variable_value_name\" : \"Black\"},{ \"variable_value_id\" : 323,\"variable_value_name\" : \"Blue\"},{ \"variable_value_id\" : 324,\"variable_value_name\" : \"Green\"},{ \"variable_value_id\" : 325,\"variable_value_name\" : \"Red\"},{ \"variable_value_id\" : 326,\"variable_value_name\" : \"Orange\"},{ \"variable_value_id\" : 327,\"variable_value_name\" : \"Pink\"},{ \"variable_value_id\" : 328,\"variable_value_name\" : \"Purple\"},{ \"variable_value_id\" : 329,\"variable_value_name\" : \"White\"},{ \"variable_value_id\" : 330,\"variable_value_name\" : \"Yellow\"}],\"variable_id\" : 38,\"variable_name\" : \"Colours\"}],\"variable_group_id\" : 37,\"variable_group_name\" : \"General\"} ]";
	session->close(OK, body, { { "Content-Length", ::to_string(body.length()) } });
}
void get_Vendors_param_func(const std::shared_ptr< Session > session)
{
	/*stringstream id;
	id << ::this_thread::get_id();
	auto body = String::format("Thread:%s,Password Protected! \n", id.str().data());*/

	const auto request = session->get_request();
	auto ret = request->get_query_parameters();
	for (auto& r : ret)
		cout << r.first << ":" << r.second << endl;
	string body = "[ { \"vendor_id\" : 864,  \"vendor_name\" : \"TEST VENDOR\"  },  { \"vendor_id\" : 1840,  \"vendor_name\" : \"USD Test Vendor\"  }  ]";
	session->close(OK, body, { { "Content-Length", ::to_string(body.length()) } });
}