TEST_P(RFC1867CR, test) { for (size_t i = 1; i < GetParam().size(); i++) { auto data = makePost({{"foo", "bar"}, {"jojo", "binky"}}, {{"file1", GetParam()}}, {}); testSimple(std::move(data), GetParam().size(), i); } }
TEST_F(RFC1867Test, TestSplits) { for (size_t i = 1; i < 500; i++) { size_t fileSize = 1000 + i; auto data = makePost( {{"foo", "bar"}, {"jojo", "binky"}}, {}, {{"file1", {"", fileSize}}}); testSimple(std::move(data), 3 + 5 + fileSize, i, 3); } }
int ArduinoHue::fillRequestAndProcess(int light,boolean useState){ if(useState){ sprintf(_buffer, "lights/%i/state",light); } else{ sprintf(_buffer, "lights/%i",light); } if(makePost(_buffer, _lastResponse)){ return evaluateResponse(); } return STATUS_POST_ERROR; }
TEST_F(RFC1867Test, TestHeadersChunkExtraCr) { // We are testing here that we correctly chunk when the parser has just // finished parsing a CR. auto numCRs = 5; auto headerEndingSeq = "--" + string(numCRs, '\r') + "\n"; auto fileSize = 10; auto data = makePost({{"foo", "bar"}, {"jojo", "binky"}}, {}, {{"file1", {"", fileSize}}}, headerEndingSeq); // Math ensures we the parser will chunk at a '\r' with a numCRs-1 testSimple(std::move(data), 3 + 5 + fileSize, numCRs - 1, 3); }
TEST_F(RFC1867Test, TestSimplePost) { size_t fileSize = 17; auto data = makePost( {{"foo", "bar"}, {"jojo", "binky"}}, {}, {{"file1", {"", fileSize}}}); testSimple(std::move(data), 3 + 5 + fileSize, 0, 3); }