network/http_methods/http_delete.c
/*******************************************************************************
* # License
* Copyright 2019 Silicon Laboratories Inc. www.silabs.com
*******************************************************************************
*
* The licensor of this software is Silicon Laboratories Inc. Your use of this
* software is governed by the terms of Silicon Labs Master Software License
* Agreement (MSLA) available at
* www.silabs.com/about-us/legal/master-software-license-agreement. This
* software is distributed to you in Source Code format and is governed by the
* sections of the MSLA applicable to Source Code.
*
******************************************************************************/
#include "common.h"
/*************************************************************************************************/
void http_delete_example(void)
{
GOS_LOG("Running HTTP: DELETE %s", bin_url);
gos_result_t result;
gos_handle_t handle;
gos_http_response_t response;
gos_http_request_t request =
{
.method = GOS_HTTP_DELETE,
.url = bin_url,
};
GOS_LOG("Issuing http_delete request ... ");
{
GOS_LOG("Request failed: %d", result);
return;
}
GOS_LOG("Adding custom header ... ");
{
GOS_LOG("Failed to add header: %d", result);
return;
}
GOS_LOG("Receiving response ... ");
{
GOS_LOG("Response failed: %d", result);
return;
}
if (response.content_length > 0)
{
uint32_t bytes_read;
char buffer[256];
GOS_LOG("Response:");
{
GOS_LOG("Failed to read response: %d", result);
return;
}
buffer[bytes_read] = 0;
GOS_LOG("%s", buffer);
}
gos_http_close(handle);
GOS_LOG("Success\r\n");
}