Code Explainers
Code explainers tagged #http-headers
rust
use axum::{ extract::{FromRef, FromRequestParts, State}, http::{header::ACCEPT_LANGUAGE, request::Parts, StatusCode}, response::{IntoResponse, Response},
A custom Accept-Language extractor in Axum
extractors
internationalization
http-headers
Advanced
8 steps
rust
use axum::{ async_trait, extract::FromRequestParts, http::{header::HeaderValue, request::Parts, HeaderName},
Propagating trace context in Axum extractors
extractors
distributed-tracing
http-headers
Intermediate
8 steps
php
<?php function streamFileWithRanges(string $path, ?string $rangeHeader): void {
How HTTP range requests stream files in PHP
http-range-requests
streaming
partial-content
Intermediate
10 steps
python
import csv import io from typing import Annotated
Content negotiation in FastAPI
content-negotiation
dependency-injection
http-headers
Intermediate
5 steps
rust
use axum::{ async_trait, extract::FromRequestParts, http::{header::HeaderName, request::Parts, StatusCode},
A custom tenant extractor in Axum
extractors
middleware
error-handling
Intermediate
7 steps
rust
#[derive(Deserialize)] pub struct CreateArticle { title: String, body: String,
Building a create endpoint in Axum
extractors
json-deserialization
sqlx
Intermediate
7 steps
java
@Component public class HeaderMergeFilter { private static final String PER_REQUEST_HEADERS = HeaderMergeFilter.class.getName() + ".headers";
Merging default and per-request headers in Spring
webclient
filters
http-headers
Intermediate
8 steps
python
from flask import Flask, request, g, jsonify from flask_babel import Babel, gettext as _, format_datetime from datetime import datetime
Per-request localization in Flask with Babel
i18n
content-negotiation
request-lifecycle
Intermediate
8 steps
ruby
module Paginatable extend ActiveSupport::Concern private
A reusable pagination concern in Rails
pagination
concerns
http-headers
Intermediate
8 steps
python
from flask import Blueprint, render_template, jsonify, request, abort from .models import Article
Content negotiation in a Flask Blueprint
content-negotiation
http-headers
routing
Intermediate
7 steps
php
<?php namespace App\Http\Support;
Adding RFC 5988 Link headers in Laravel
pagination
http-headers
rest-api
Intermediate
7 steps
rust
use std::net::{IpAddr, SocketAddr}; use axum::extract::{ConnectInfo, FromRequestParts}; use axum::http::request::Parts;
How a custom ClientIp extractor works in Axum
extractor
http-headers
proxy-forwarding
Intermediate
8 steps
go
func (h *ExportHandler) BulkExport(c *gin.Context) { projectID := c.Param("projectID") reports, err := h.reports.ListByProject(c.Request.Context(), projectID)
Streaming a ZIP download in Gin
streaming
zip-archive
http-headers
Intermediate
8 steps
php
<?php namespace App\Http\Controllers;
Server-Sent Events in Laravel
server-sent-events
streaming
long-polling
Advanced
9 steps
rust
use axum::{ extract::FromRequestParts, http::{request::Parts, StatusCode, header::ACCEPT_LANGUAGE}, };
A locale extractor for Axum handlers
content-negotiation
http-headers
custom-extractor
Intermediate
7 steps
rust
use axum::{ extract::{Request, State}, http::{HeaderValue, StatusCode}, middleware::Next,
API version headers with Axum middleware
middleware
http-headers
versioning
Intermediate
8 steps
rust
use axum::{ body::Body, http::{header, HeaderValue, StatusCode, Uri}, response::{IntoResponse, Response},
Serving embedded static files in Axum
static-assets
embedding
http-headers
Intermediate
7 steps
ruby
class Admin::OrdersExportController < Admin::BaseController include ActionController::Live def show
Streaming a CSV export in Rails
streaming
csv-export
batching
Advanced
8 steps