Code Explainers

Code explainers tagged #conditional-requests

go
package api
 
import (
	"crypto/sha256"

ETag conditional requests in Gin

http-caching etag conditional-requests
Intermediate 6 steps
javascript
const express = require('express');
const crypto = require('crypto');
const router = express.Router();
 

Optimistic locking with ETags in Express

optimistic-locking etag conditional-requests
Intermediate 7 steps
typescript
import {
  Controller,
  Get,
  Param,

HTTP conditional caching in a NestJS controller

http-caching etag conditional-requests
Intermediate 7 steps
java
@Configuration
public class WebConfig {
 
    @Bean

HTTP caching with ETags in Spring

http-caching etag servlet-filters
Intermediate 6 steps
python
from pathlib import Path
 
from django.contrib.auth.decorators import login_required
from django.http import FileResponse, Http404, HttpResponseForbidden

Serving files with access checks in Django

authorization http-caching file-serving
Intermediate 7 steps
python
import hashlib
import json
from fastapi import APIRouter, Request, Response, Depends, HTTPException, status
 

HTTP ETag caching in a FastAPI route

http-caching etag conditional-requests
Intermediate 9 steps
python
import hashlib
import os
from datetime import timedelta
 

Serving cacheable static assets in Flask

http-caching etag conditional-requests
Intermediate 8 steps
rust
use axum::{
    extract::State,
    http::{header, HeaderMap, StatusCode},
    response::{IntoResponse, Response},

Conditional GET caching in Axum

http-caching conditional-requests extractors
Intermediate 7 steps
php
<?php
 
namespace App\Http\Middleware;
 

ETag caching and gzip in Laravel middleware

middleware http-caching etag
Intermediate 8 steps
go
func GetArticle(c *gin.Context) {
	id := c.Param("id")
 
	article, err := articleRepo.FindByID(c.Request.Context(), id)

Conditional GET with ETags in Gin

http-caching etag conditional-requests
Intermediate 7 steps