test_direct.ps1 958 B

12345678910111213141516171819
  1. $body = '{"tenantCode":"T202605253515","username":"admin","password":"admin123"}'
  2. $r = Invoke-WebRequest -Uri 'http://localhost:8006/login' -Method Post -ContentType 'application/json' -Body $body -UseBasicParsing
  3. $j = $r.Content | ConvertFrom-Json
  4. $token = $j.token
  5. Write-Host "Login: code=$($j.code) token_len=$($token.Length)"
  6. # Test his endpoints
  7. $tests = @('/his/healthTongue/list', '/his/healthRecord/list', '/his/doctor/list', '/course/courseDomainName/list', '/qw/tag/list', '/billing/wallet/list')
  8. foreach ($p in $tests) {
  9. try {
  10. $r2 = Invoke-WebRequest -Uri "http://localhost:8006$p" -Method Get -Headers @{Authorization="Bearer $token"} -UseBasicParsing -TimeoutSec 5 -ErrorAction Stop
  11. $j2 = $r2.Content | ConvertFrom-Json
  12. Write-Host "$p => code=$($j2.code)"
  13. } catch {
  14. $sc = 0
  15. if ($_.Exception.Response) { $sc = [int]$_.Exception.Response.StatusCode }
  16. Write-Host "$p => $sc ERROR"
  17. }
  18. }