Pode PowerShell
/pixel.gif 요청에 빈 GIF로 응답하는 Pode용 PowerShell 스니펫입니다. GIF는 시작할 때 한 번만 디코딩합니다.
Pode PowerShell
Import-Module Pode
Start-PodeServer {
Add-PodeEndpoint -Address * -Port 8080 -Protocol Http
Set-PodeState -Name 'Gif' -Value ([Convert]::FromBase64String('R0lGODlhAQABAIAAAP///wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==')) | Out-Null
Add-PodeRoute -Method Get -Path '/pixel.gif' -ScriptBlock {
Set-PodeHeader -Name 'Cache-Control' -Value 'no-store'
# Pode appends '; charset=utf-8' to the type; browsers ignore it for images.
Write-PodeTextResponse -Bytes (Get-PodeState -Name 'Gif') -ContentType 'image/gif'
}
}
이 스니펫은 실행해 보고, 반환된 바이트를 비교했습니다.
확인
curl -sI http://localhost:8080/pixel.gif