Lahat ng language at framework
Pode PowerShell
Isang PowerShell snippet para sa Pode na sumasagot sa mga request sa /pixel.gif gamit ang empty GIF, na isang beses lang dine-decode sa startup.
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'
}
}
Pinatakbo namin ang snippet na ito at ikinumpara ang mga byte na ibinalik nito.
Suriin
curl -sI http://localhost:8080/pixel.gif