#include "request.h"
int main()
{
gfxInitDefault();
consoleInit(GFX_TOP, NULL);
printf("Press B to exit\n");
while (aptMainLoop())
{
gspWaitForVBlank();
hidScanInput();
u32 kDown = hidKeysDown();
if (kDown & KEY_B)
break; // break in order to return to hbmenu
if (kDown & KEY_START) {
aptInit();
aptSetSleepAllowed(false);
aptExit();
}
printf("Request Start\n");
Request* request = new_Request("GET", "yls8.mtheall. com", "/testpage", "limit=1");
char* out = malloc(sizeof(char)*2048);
if (network_request(request, out)) {
printf("%s\n", out);
printf("Request Done\n");
} else {
printf("Request failed\n");
}
printf("Allowed to sleep: %d\n", aptIsSleepAllowed());
destroy_Request(request);
free(out);
svcSleepThread(2000000000);
// Flush and swap framebuffers
gfxFlushBuffers();
gfxSwapBuffers();
}
gfxExit();
return 0;
}