Microsoft Graph API에서 오류 시뮬레이션
Microsoft Graph는 Microsoft 365의 데이터 및 인사이트에 액세스할 수 있는 API 컬렉션입니다. 앱에서 Microsoft Graph를 사용하는 경우 앱에서 API 오류를 처리하는 방법을 테스트해야 합니다. 개발자 프록시를 사용하면 을 사용하여 Microsoft Graph API 오류를 시뮬레이션할 GraphRandomErrorPlugin
수 있습니다.
는 GraphRandomErrorPlugin
Microsoft Graph를 사용하도록 최적화되고 Microsoft Graph에서 반환할 수 있는 특정 오류를 시뮬레이션합니다.
시작하려면 구성 파일에서 을 GraphRandomErrorPlugin
사용하도록 설정합니다.
{
"$schema": "https://raw.githubusercontent.com/microsoft/dev-proxy/main/schemas/v0.14.1/rc.schema.json",
"plugins": [
{
"name": "GraphRandomErrorPlugin",
"enabled": true,
"pluginPath": "~appFolder/plugins/dev-proxy-plugins.dll",
"configSection": "graphRandomErrorPlugin",
"urlsToWatch": [
"https://graph.microsoft.com/v1.0/*",
"https://graph.microsoft.com/beta/*",
"https://graph.microsoft.us/v1.0/*",
"https://graph.microsoft.us/beta/*",
"https://dod-graph.microsoft.us/v1.0/*",
"https://dod-graph.microsoft.us/beta/*",
"https://microsoftgraph.chinacloudapi.cn/v1.0/*",
"https://microsoftgraph.chinacloudapi.cn/beta/*"
]
}
]
}
팁
위의 코드 조각은 모든 Microsoft 클라우드에서 Microsoft Graph에 대한 요청을 수신 대기합니다. 특정 Microsoft 클라우드에서만 오류를 시뮬레이션하려면 필요하지 않은 URL을 제거합니다.
구성 파일로 개발자 프록시를 시작하고 앱을 사용하여 오류를 처리하는 방법을 확인합니다. 일치하는 각 요청에 대해 Dev Proxy는 구성된 실패율을 사용하여 오류를 시뮬레이트할지 아니면 Microsoft Graph에 요청을 전달할지 결정합니다. 개발자 프록시는 오류를 시뮬레이션할 때 Microsoft Graph에서 사용하는 오류 중 하나를 임의로 선택하고 앱에 오류 응답을 반환합니다.
시뮬레이션할 오류 구성
기본적으로 는 GraphRandomErrorPlugin
다음 오류를 시뮬레이션합니다.
HTTP 메서드 | 가능한 오류 |
---|---|
GET |
429 Too Many Requests , 500 Internal Server Error , 502 Bad Gateway , 503 Service Unavailable , 504 Gateway Timeout |
POST |
429 Too Many Requests , 500 Internal Server Error , 502 Bad Gateway , 503 Service Unavailable , 504 Gateway Timeout , 507 Insufficient Storage |
PUT |
429 Too Many Requests , 500 Internal Server Error , 502 Bad Gateway , 503 Service Unavailable , 504 Gateway Timeout , 507 Insufficient Storage |
PATCH |
429 Too Many Requests , 500 Internal Server Error , 502 Bad Gateway , 503 Service Unavailable , 504 Gateway Timeout |
DELETE |
429 Too Many Requests , 500 Internal Server Error , 502 Bad Gateway , 503 Service Unavailable , 504 Gateway Timeout , 507 Insufficient Storage |
제한과 같은 특정 동작을 테스트하려면 옵션을 사용하여 관련 오류만 사용하도록 플러그 인을 --allowed-errors
구성합니다.
devproxy --allowed-errors 429
또는 구성 파일의 allowedErrors
개체에서 graphRandomErrorPlugin
속성을 구성할 수 있습니다.
{
"graphRandomErrorPlugin": {
"allowedErrors": [ 429 ]
}
}
Microsoft Graph 일괄 처리 요청에서 오류 시뮬레이션
개발자 프록시는 일반 요청과 동일한 방식으로 Microsoft Graph에 대한 일괄 처리 요청의 오류를 시뮬레이션합니다. 개발자 프록시는 일괄 처리 요청에서 하나 이상의 요청에 실패하면 Microsoft Graph와 마찬가지로 전체 일괄 처리 요청에 대한 응답을 반환 424 Failed Dependency
합니다.
Dev Proxy
피드백
https://aka.ms/ContentUserFeedback
출시 예정: 2024년 내내 콘텐츠에 대한 피드백 메커니즘으로 GitHub 문제를 단계적으로 폐지하고 이를 새로운 피드백 시스템으로 바꿀 예정입니다. 자세한 내용은 다음을 참조하세요.다음에 대한 사용자 의견 제출 및 보기