Browse Source

Re-add METHOD_ prefix to network::Method enums

tags/v1.0.0
Andrew Belt 5 years ago
parent
commit
df0388c9fb
8 changed files with 17 additions and 17 deletions
  1. +1
    -1
      dep/glfw
  2. +1
    -1
      dep/nanosvg
  3. +1
    -1
      dep/nanovg
  4. +1
    -1
      dep/rtaudio
  5. +4
    -4
      include/network.hpp
  6. +1
    -1
      src/app/Scene.cpp
  7. +5
    -5
      src/network.cpp
  8. +3
    -3
      src/plugin.cpp

+ 1
- 1
dep/glfw

@@ -1 +1 @@
Subproject commit d9ab59efc781c392128a449361a381fcc93cf6f3
Subproject commit 7ba23eb03854dfe6ce36cc6d61cb913f76cad774

+ 1
- 1
dep/nanosvg

@@ -1 +1 @@
Subproject commit 25241c5a8f8451d41ab1b02ab2d865b01600d949
Subproject commit c1f6e209c16b18b46aa9f45d7e619acf42c29726

+ 1
- 1
dep/nanovg

@@ -1 +1 @@
Subproject commit 1f9c8864fc556a1be4d4bf1d6bfe20cde25734b4
Subproject commit f4069e6a1ad5da430fb0a9c57476d5ddc2ff89b2

+ 1
- 1
dep/rtaudio

@@ -1 +1 @@
Subproject commit d27f257b4bc827e4152cdc4d69a2e22084204afd
Subproject commit b9468aa6f82fdea1f3dc364f477e859b39f0bb2a

+ 4
- 4
include/network.hpp View File

@@ -12,10 +12,10 @@ namespace network {


enum Method {
GET,
POST,
PUT,
DELETE,
METHOD_GET,
METHOD_POST,
METHOD_PUT,
METHOD_DELETE,
};

/** Requests a JSON API URL over HTTP(S), using the data as the query (GET) or the body (POST, etc)


+ 1
- 1
src/app/Scene.cpp View File

@@ -170,7 +170,7 @@ void Scene::onPathDrop(const event::PathDrop &e) {
void Scene::runCheckVersion() {
std::string versionUrl = app::API_URL;
versionUrl += "/version";
json_t *versionResJ = network::requestJson(network::GET, versionUrl, NULL);
json_t *versionResJ = network::requestJson(network::METHOD_GET, versionUrl, NULL);

if (versionResJ) {
json_t *versionJ = json_object_get(versionResJ, "version");


+ 5
- 5
src/network.cpp View File

@@ -24,7 +24,7 @@ json_t *requestJson(Method method, std::string url, json_t *dataJ) {

// Process data
if (dataJ) {
if (method == GET) {
if (method == METHOD_GET) {
// Append ?key=value&... to url
url += "?";
bool isFirst = true;
@@ -54,16 +54,16 @@ json_t *requestJson(Method method, std::string url, json_t *dataJ) {

// Set HTTP method
switch (method) {
case GET:
case METHOD_GET:
// This is CURL's default
break;
case POST:
case METHOD_POST:
curl_easy_setopt(curl, CURLOPT_POST, true);
break;
case PUT:
case METHOD_PUT:
curl_easy_setopt(curl, CURLOPT_PUT, true);
break;
case DELETE:
case METHOD_DELETE:
curl_easy_setopt(curl, CURLOPT_CUSTOMREQUEST, "DELETE");
break;
}


+ 3
- 3
src/plugin.cpp View File

@@ -351,7 +351,7 @@ void logIn(const std::string &email, const std::string &password) {
json_object_set(reqJ, "password", json_string(password.c_str()));
std::string url = app::API_URL;
url += "/token";
json_t *resJ = network::requestJson(network::POST, url, reqJ);
json_t *resJ = network::requestJson(network::METHOD_POST, url, reqJ);
json_decref(reqJ);

if (!resJ) {
@@ -392,7 +392,7 @@ void queryUpdates() {
json_object_set(pluginsReqJ, "token", json_string(settings::token.c_str()));
std::string pluginsUrl = app::API_URL;
pluginsUrl += "/plugins";
json_t *pluginsResJ = network::requestJson(network::GET, pluginsUrl, pluginsReqJ);
json_t *pluginsResJ = network::requestJson(network::METHOD_GET, pluginsUrl, pluginsReqJ);
json_decref(pluginsReqJ);
if (!pluginsResJ) {
WARN("Request for user's plugins failed");
@@ -411,7 +411,7 @@ void queryUpdates() {
// Get community manifests
std::string manifestsUrl = app::API_URL;
manifestsUrl += "/community/manifests";
json_t *manifestsResJ = network::requestJson(network::GET, manifestsUrl, NULL);
json_t *manifestsResJ = network::requestJson(network::METHOD_GET, manifestsUrl, NULL);
if (!manifestsResJ) {
WARN("Request for community manifests failed");
return;


Loading…
Cancel
Save