# Test cloud functions - get detailed error info $ct = "application/json" # Test 1: getApigInfo without _ApplicationId Write-Host "=== Test 1: No AppId ===" -ForegroundColor Cyan try { $body = '{"apigId":"Vo3ROWEvDy"}' $r = Invoke-WebRequest -Uri "https://server.fmode.cn/parse/functions/t012qy4XVe" -Method POST -ContentType $ct -Body $body -TimeoutSec 10 Write-Host "Status: $($r.StatusCode) Body: $($r.Content)" } catch { if ($_.Exception.Response) { $stream = $_.Exception.Response.GetResponseStream() $reader = New-Object System.IO.StreamReader($stream) Write-Host "Status: $($_.Exception.Response.StatusCode) Body: $($reader.ReadToEnd())" -ForegroundColor Yellow } else { Write-Host "Error: $($_.Exception.Message)" -ForegroundColor Red } } Write-Host "" # Test 2: With _ApplicationId in body Write-Host "=== Test 2: AppId in body ===" -ForegroundColor Cyan try { $body = '{"_ApplicationId":"ncloudmaster","apigId":"Vo3ROWEvDy"}' $r = Invoke-WebRequest -Uri "https://server.fmode.cn/parse/functions/t012qy4XVe" -Method POST -ContentType $ct -Body $body -TimeoutSec 10 Write-Host "Status: $($r.StatusCode) Body: $($r.Content)" } catch { if ($_.Exception.Response) { $stream = $_.Exception.Response.GetResponseStream() $reader = New-Object System.IO.StreamReader($stream) Write-Host "Status: $($_.Exception.Response.StatusCode) Body: $($reader.ReadToEnd())" -ForegroundColor Yellow } else { Write-Host "Error: $($_.Exception.Message)" -ForegroundColor Red } } Write-Host "" # Test 3: With X-Parse-Application-Id header Write-Host "=== Test 3: AppId in header ===" -ForegroundColor Cyan try { $headers = @{ "X-Parse-Application-Id" = "ncloudmaster"; "Content-Type" = $ct } $body = '{"apigId":"Vo3ROWEvDy"}' $r = Invoke-WebRequest -Uri "https://server.fmode.cn/parse/functions/t012qy4XVe" -Method POST -Headers $headers -Body $body -TimeoutSec 10 Write-Host "Status: $($r.StatusCode) Body: $($r.Content)" } catch { if ($_.Exception.Response) { $stream = $_.Exception.Response.GetResponseStream() $reader = New-Object System.IO.StreamReader($stream) Write-Host "Status: $($_.Exception.Response.StatusCode) Body: $($reader.ReadToEnd())" -ForegroundColor Yellow } else { Write-Host "Error: $($_.Exception.Message)" -ForegroundColor Red } } Write-Host "" # Test 4: Same as pay_code2 pattern (which works in the page) Write-Host "=== Test 4: pay_code2 pattern (reference) ===" -ForegroundColor Cyan try { $body = '{"trade_no":"TEST123","total_fee":0.01,"body":"test","company":"1AiWpTEDH9"}' $r = Invoke-WebRequest -Uri "https://server.fmode.cn/parse/functions/pay_code2" -Method POST -ContentType $ct -Body $body -TimeoutSec 10 Write-Host "Status: $($r.StatusCode) Body: $($r.Content.Substring(0,200))" -ForegroundColor Green } catch { if ($_.Exception.Response) { $stream = $_.Exception.Response.GetResponseStream() $reader = New-Object System.IO.StreamReader($stream) Write-Host "Status: $($_.Exception.Response.StatusCode) Body: $($reader.ReadToEnd())" -ForegroundColor Yellow } else { Write-Host "Error: $($_.Exception.Message)" -ForegroundColor Red } }