feat(http): Postman-parity auto headers#17
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Kapatır #12.
Postman tarzı auto header sistemi: kullanıcı her request öncesi hangi header'ların otomatik eklendiğini görür, istediğini disable eder ve kendi eklediği header otomatik olanı case-insensitive override eder.
Kapsam (7 madde)
packages/http-core/src/auto-headers.ts(yeni) —buildAutoHeaders,contentTypeForBody,mergeHeaders. User-Agent / Accept / Accept-Encoding / Cache-Control / Connection / X-Scrapeman-Token (per-request UUID) + body'den türetilen Content-Type.packages/shared-types/src/index.ts—ScrapemanRequest.disabledAutoHeaders?: string[]alanı eklendi.packages/http-core/src/adapters/undici-executor.ts—autoHeaderEnvconstructor opsiyonu; herexecuteçağrısındabuildAutoHeaders+mergeHeadersuygulanıyor, böylece executor tek başına kullanıldığında da doğru header'lar gidiyor.apps/desktop/src/main/index.ts—UndiciExecutorgerçekapp.getVersion()+process.platform process.archile kuruluyor;disabledAutoHeadersmevcutScrapemanRequestalanı üzerinden doğal olarak geçiyor (variable / auth / scrape-do / cookie çözümleme sırası değişmedi).apps/desktop/src/renderer/src/components/AutoHeadersPanel.tsx(yeni) — Headers tab'ının üstünde collapsible panel; her satır için toggle, user header varsa "overridden" badge, Host + Content-Length readonly.apps/desktop/src/renderer/src/store.ts—BuilderState.disabledAutoHeaders+setDisabledAutoHeadersaction;buildRequestserialize sırasında request'e ekliyor.packages/http-core/tests/auto-headers.test.ts(yeni) — 12 vitest case: her header'ın varlığı, User-Agent formatı, UUID uniqueness, Content-Type tablosu, multipart skip, user override case-insensitive, disabled set, user+disabled kombinasyonu.Test sonucu
pnpm -r typecheck— temizpnpm -r test— 137 passed (12 yeni)pnpm --filter=@scrapeman/desktop build— başarılıNotlar / judgment calls
decompress: trueatlandı: kurulu undici7.25.0sürümürequest()içindecompressopsiyonunu kabul etmiyor (node_modules/undici/typesiçinde böyle bir alan yok). Accept-Encoding header'ı yine de gönderiliyor; response decompress otomatik değil. Upgrade sonrası tek satırla eklenebilir.X-Scrapeman-TokenUI preview'ında<uuid per request>placeholder gösteriliyor — gerçek değer her request'te yeniden üretiliyor.