I have an flask API which is returning an HTML table.
sample resp is
{
"type": "text",
"content": "<table border="1" class="dataframe table table-striped">n <thead>n <tr style="text-align: right;">n <th></th>n <th>Business Group</th>n <th>Person Type</th>n <th>Date of Birth</th>n <th>Hire Date</th>n <th>Tenure</th>n <th>Job Name</th>n <th>Job Level</th>n <th>HR Business Partner</th>n <th>Country</th>n <th>Geo</th>n <th>Age</th>n <th>Gender</th>n <th>Grade Type</th>n </tr>n </thead>n <tbody>n <tr>n <th>91</th>n <td>HR</td>n <td>Employee</td>n <td>1973-09-15</td>n <td>2020-06-09</td>n <td>4.257534</td>n <td>Product Designer</td>n <td>Manager</td>n <td>Luis Mendez</td>n <td>United States</td>n <td>Americas</td>n <td>51.021918</td>n <td>Female</td>n <td>3</td>n </tr>n </tbody>n</table>"
}
I am reading this in HTML/JS using the below code block
then(response => {
const reader = response.body.getReader();
const decoder = new TextDecoder();
return reader.read().then(function processText({ done, value }) {
if (done) {
hideSpinner();
return;
}
const chunk = decoder.decode(value, { stream: true });
I am checking the chunk
variable it is not giving me proper response. It shows value like this:
{"type": "text", "content": "<table border="1" class="dataframe table table-striped">n <thead>n <tr style="text-align: right;">n <th></th>n
<th>Business Group</th>n <th>Person Type</th>n <th>Date of Birth</th>n <th>Hire Date</th>n <th>Tenure</th>n <th>Job Name</th>n <th>Job Level</th>n <th>HR Business Partner</th>n <th>Country</th>n <th>Geo</th>n <th>Age</th>n <th>Gender</th>n <th>Grade Type</th>n </tr>n </thead>n <tbody>n <tr>n <th>91</th>n <td>HR</td>n <td>Employee</td>n <td>1973-09-15</td>n <td>2020-06-09</td>n <td>4.257534</td>n <td>Product Designer</td>n <td>Manager</td>n <td>Luis Mendez</td>n <td>United States</td>n <td>Americas</td>n <td>51.021918</td>n <td>Female</td>n <td>3</td>n
The response is truncated. What can be done to rectify it?