/** * This is a special case to make sure we get a 404 in case of a missing token on the public * download page * * @param \Step\Api\TokenUser $I */ public function TryTodownloadFileWithoutAToken(\Step\Api\TokenUser $I) { $I->am('a thief'); $I->wantTo('steal all the files I can get my hands on'); $fileMetaData = $I->getSharedFileInformation(); $params = ['fileId' => $fileMetaData['fileId']]; $I->haveHttpHeader('Accept', $this->browserHeader); $I->sendGET(GalleryApp::$URL . '/files.public/download/{fileId}', $params); $I->seeResponseCodeIs(404); $I->seeHttpHeader('Content-type', 'text/html; charset=UTF-8'); }
private function connect(\Step\Api\TokenUser $I, $url, $params = [], $acceptHeaders = 'application/json, text/javascript, */*;q=0.01') { $I->haveHttpHeader('Accept', $this->browserHeader); $I->sendGET('/'); $html = $I->grabResponse(); $tidy = tidy_parse_string($html); $head = $tidy->head(); $requestToken = $head->attribute['data-requesttoken']; $I->haveHttpHeader('Accept', $acceptHeaders); $I->haveHttpHeader('requesttoken', $requestToken); $params = array_merge($params, ['token' => $this->folderMetaData['token'], 'password' => $this->folderMetaData['password']]); $I->sendGET($url, $params); }