---
title: "Why we should verify HTTP response bodies, and why we should use zod for this"
url: https://daily.dev/posts/why-we-should-verify-http-response-bodies-and-why-we-should-use-zod-for-this-qepygitr3
source_url: https://timdeschryver.dev/blog/why-we-should-verify-http-response-bodies-and-why-we-should-use-zod-for-this
type: article
source: "Tim Deschryver"
author: "Tim Deschryver"
published: 2026-05-31T07:47:35.693Z
updated: 2026-06-01T04:01:42.409Z
tags: ["typescript", "angular", "rxjs", "zod"]
reading_time: 9
upvotes: 0
comments: 0
language: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Why we should verify HTTP response bodies, and why we should use zod for this

**[Tim Deschryver](https://daily.dev/sources/timdeschryver)** · [@timdeschryver](https://daily.dev/timdeschryver) · 9 min read · 0 upvotes · 0 comments

## Summary

TypeScript's static types don't protect against unexpected HTTP response shapes at runtime, leading to hard-to-debug errors. Zod solves this by letting you define a schema once, infer the TypeScript type from it, and parse response bodies at runtime. The post walks through replacing a plain Angular HTTP service with one that uses a custom RxJS operator (`parseResponse`) wrapping Zod's `parse` (throws in dev) and `safeParse` (logs silently in prod) methods. The result is early, descriptive error messages when API responses drift from expectations, with minimal performance overhead and no changes needed outside the service layer.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://timdeschryver.dev/blog/why-we-should-verify-http-response-bodies-and-why-we-should-use-zod-for-this>

## Similar posts on daily.dev

- [Zod \+ TypeScript: Schema Validation Made Easy](https://daily.dev/posts/zod-typescript-schema-validation-made-easy-w9edwu63u) · Telerik · 1 upvotes · 1 comments
- [Zod: Type-Safe Schema Validation for TypeScript](https://daily.dev/posts/zod-type-safe-schema-validation-for-typescript-ea5i1fg8l) · Flavio Copes · 1 upvotes · 0 comments
- [Zod \+ TypeScript: Schema Validation Made Easy – Frontend Masters Blog](https://daily.dev/posts/zod-typescript-schema-validation-made-easy-frontend-masters-blog-yv5epna6v) · Frontend Masters · 0 upvotes · 0 comments
- [When to Use Zod, TypeScript, or Both: A Developer’s Guide](https://daily.dev/posts/when-to-use-zod-typescript-or-both-a-developer-s-guide-pk2awzwey) · LogRocket · 17 upvotes · 0 comments
- [From GraphQL to Zod: Simplifying Arte's API Architecture](https://daily.dev/posts/from-graphql-to-zod-simplifying-arte-s-api-architecture-t98xzft0w) · marmelab · 27 upvotes · 4 comments

---

Tags: [#typescript](https://daily.dev/tags/typescript), [#angular](https://daily.dev/tags/angular), [#rxjs](https://daily.dev/tags/rxjs), [#zod](https://daily.dev/tags/zod)

[View this post on daily.dev](https://daily.dev/posts/why-we-should-verify-http-response-bodies-and-why-we-should-use-zod-for-this-qepygitr3)
