I am trying to get JSON response (punch-in and punch-out details in JSON format) from the POST request but all i get is redirect 302 error and there is no location in the request headers.
import 'package:http/http.dart' as http;
import 'package:dotp/dotp.dart';
void main() async {
var client = http.Client();
var login_url = 'https://test.site.com/index.php/index/loginpopupsave';
var login_response = await client.post(login_url, body: {'username':'1234','password':'1234@2018'});
print('Response status: ${login_response.statusCode}');
print('Response body: ${login_response.body}');
var otp_url = 'https://test.site.com/index.php/index';
var otp_response = await client.post(otp_url, body: {'verfication_code': TOTP("WRELBKVQMDBJDWER").now(),'user_id':'lzpZSd'});
print('Response status: ${otp_response.statusCode}');
print('Response body: ${otp_response.body}');
var time_sheet_url = 'https://test.site.com/index.php/timemanagement/attendance/getemployeeattendance/format/json';
var time_sheet_res = await client.post(time_sheet_url, body: {'userId': '199','selectedDate':'12-Nov-2019'});
print('Response status: ${time_sheet_res.statusCode}');
print('Response body: ${time_sheet_res.body}');
}