Sign in

Specification of data format returned by background interface

zfqlj edited in Tue, 18 Oct 2022

The scenario is like this: in the data returned by the background, there is a field that specifies the type of array to be returned. If there is data, it is an array. If there is no data, it is an empty array. However, when it is online, it is found that the data returned by the background is null, resulting in the front-end program reporting an error and unable to go on. The background staff feel that this is reasonable. The reason is that there is data that is an array, and if there is data, it is deleted Return null, I am also convinced, this kind of return data type transformation has been more than once, what do you think of this matter???

4 Replies
commented on Tue, 18 Oct 2022
  • Let him change if you can
  • If you don't know what to say, you can handle it by yourself, and write notes to explain that the interface may return special data and need special processing, so as not to make it difficult for later people to understand
commented on Tue, 18 Oct 2022

According to the interface document

commented on Tue, 18 Oct 2022

If the interface document is very clear, you don't have to waste a lot of time, just follow the document.

commented on Tue, 18 Oct 2022

On the one hand, according to the documents, on the other hand, it's better to deal with this kind of problem in the front end. Don't believe what kind of data the back end will transmit to you_ T。。。。 The get method in lodash is very practical

lock This question has been locked and the reply function has been disabled.