Closed david03g closed 1 year ago
The api/tournament endpoint is returning the html of the new tournament web page NOT application/json of the new tournament parameters as it used
async function createArenaTournament({ name, clockTime, clockIncrement, minutes, waitMinutes = 5, startDate, variant = 'standard', rated = true, position, berserkable = true, streakable = true, hasChat = true, description, password, teamBattleByTeam, conditions: { teamMember: { teamId = '' } = {}, minRating: { rating: minRating = '' } = {}, maxRating: { rating: maxRating = '' } = {}, nbRatedGame: { nb: nbRatedGame = '' } = {}, allowList = '' } = {} } = {}, authToken) { try {
const response = await axios.post('https://lichess.org/api/tournament', { name, clockTime, clockIncrement, minutes, waitMinutes, startDate, variant, rated, position, berserkable, streakable, hasChat, description, password, teamBattleByTeam, 'conditions.teamMember.teamId': teamId, 'conditions.minRating.rating': minRating, 'conditions.maxRating.rating': maxRating, 'conditions.nbRatedGame.nb': nbRatedGame, 'conditions.allowList': allowList }, { headers: { 'Content-Type': 'application/json', 'Authorization': `Bearer ${authToken}` } }); console.log(response.data) // return response.data;
} catch (error) { console.log(error) // throw new Error(Failed to create Arena tournament: ${error.response.data.error}); } }
Failed to create Arena tournament: ${error.response.data.error}
I recieved an html for the new tournament webpage. Not this:
{ "id": "QITRjufu", "fullName": "U1700 SuperBlitz Arena", "rated": true, "clock": { "increment": 0, "limit": 180 }, "minutes": 57, "createdBy": "lichess", "system": "arena", "secondsToStart": 0, "secondsToFinish": 36000, "isFinished": true, "isRecentlyFinished": true, "pairingsClosed": true, "startsAt": 1522803600000, "nbPlayers": 154, "perf": { "icon": ")", "key": "blitz", "name": "Blitz", "position": 1 }, "schedule": { "freq": "hourly", "speed": "superblitz" }, "variant": "standard", "duels": [ { "id": "0MM6q4tQ", "p": [ { "n": "player1", "r": 1500, "k": 3 }, { "n": "player2", "r": 1500, "k": 3 } ] } ], "standings": { "page": 1, "players": [ { "name": "player1", "rank": 1, "rating": 1500, "score": 3, "sheet": { "scores": [ { "0": 2, "1": 2 }, { "0": 4, "1": 3 }, 0 ], "total": 6, "fire": true } } ] }, "featured": { "id": "khe72Fer", "fen": "rn1qkb1r/pQ3ppp/2b2n2/8/5P2/4P3/PP4PP/RNB1KBNR", "color": "black", "lastMove": "d7c6", "white": { "rank": 2, "name": "player1", "rating": 1360 }, "black": { "rank": 5, "name": "player2", "rating": 1431 } }, "podium": [ { "name": "player1", "rank": 1, "rating": 1500, "score": 3, "sheet": { "scores": [ { "0": 2, "1": 2 }, { "0": 4, "1": 3 }, 0 ], "total": 6, "fire": true }, "nb": { "game": 3, "beserk": 0, "win": 2 }, "performance": 1787 } ], "stats": { "games": 454, "moves": 27542, "whiteWins": 236, "blackWins": 207, "draws": 11, "berserks": 0, "averageRating": 1320 } }
Mac
node.js
No response
'Content-Type': 'application/json', is the the type you're sending. If you want to receive json, you need 'Accept': 'application/json',
'Content-Type': 'application/json',
'Accept': 'application/json',
Exact URL of where the bug happened
The api/tournament endpoint is returning the html of the new tournament web page NOT application/json of the new tournament parameters as it used
Steps to reproduce the bug
async function createArenaTournament({ name, clockTime, clockIncrement, minutes, waitMinutes = 5, startDate, variant = 'standard', rated = true, position, berserkable = true, streakable = true, hasChat = true, description, password, teamBattleByTeam, conditions: { teamMember: { teamId = '' } = {}, minRating: { rating: minRating = '' } = {}, maxRating: { rating: maxRating = '' } = {}, nbRatedGame: { nb: nbRatedGame = '' } = {}, allowList = '' } = {} } = {}, authToken) { try {
} catch (error) { console.log(error) // throw new Error(
Failed to create Arena tournament: ${error.response.data.error}
); } }What did you expect to happen?
The api/tournament endpoint is returning the html of the new tournament web page NOT application/json of the new tournament parameters as it used
What happened instead?
I recieved an html for the new tournament webpage. Not this:
{ "id": "QITRjufu", "fullName": "U1700 SuperBlitz Arena", "rated": true, "clock": { "increment": 0, "limit": 180 }, "minutes": 57, "createdBy": "lichess", "system": "arena", "secondsToStart": 0, "secondsToFinish": 36000, "isFinished": true, "isRecentlyFinished": true, "pairingsClosed": true, "startsAt": 1522803600000, "nbPlayers": 154, "perf": { "icon": ")", "key": "blitz", "name": "Blitz", "position": 1 }, "schedule": { "freq": "hourly", "speed": "superblitz" }, "variant": "standard", "duels": [ { "id": "0MM6q4tQ", "p": [ { "n": "player1", "r": 1500, "k": 3 }, { "n": "player2", "r": 1500, "k": 3 } ] } ], "standings": { "page": 1, "players": [ { "name": "player1", "rank": 1, "rating": 1500, "score": 3, "sheet": { "scores": [ { "0": 2, "1": 2 }, { "0": 4, "1": 3 }, 0 ], "total": 6, "fire": true } } ] }, "featured": { "id": "khe72Fer", "fen": "rn1qkb1r/pQ3ppp/2b2n2/8/5P2/4P3/PP4PP/RNB1KBNR", "color": "black", "lastMove": "d7c6", "white": { "rank": 2, "name": "player1", "rating": 1360 }, "black": { "rank": 5, "name": "player2", "rating": 1431 } }, "podium": [ { "name": "player1", "rank": 1, "rating": 1500, "score": 3, "sheet": { "scores": [ { "0": 2, "1": 2 }, { "0": 4, "1": 3 }, 0 ], "total": 6, "fire": true }, "nb": { "game": 3, "beserk": 0, "win": 2 }, "performance": 1787 } ], "stats": { "games": 454, "moves": 27542, "whiteWins": 236, "blackWins": 207, "draws": 11, "berserks": 0, "averageRating": 1320 } }
Operating system
Mac
Browser and version (or alternate access method)
node.js
Additional information
No response