http

javascript
const Busboy = require('busboy');
const { storeFile } = require('./storage');

function parseMultipart(req, { maxFileSize = 20 * 1024 * 1024 } = {}) {
  return new Promise((resolve, reject) => {
    const busboy = Busboy({

Streaming Multipart Form Upload Parser Using Busboy in Node.js

nodejs multipart streaming
by codesnips 3 tabs
java
@RestController
@RequestMapping("/users")
public class UserPatchController {

    private final UserRepository users;
    private final JsonPatchService patchService;

Applying RFC 6902 JSON Patch with Optimistic Locking in Spring Boot

spring-boot rest-api json-patch
by codesnips 3 tabs
python
from typing import Optional
from pydantic import BaseModel, EmailStr, Field, field_validator, model_validator


class CreateUserRequest(BaseModel):
    model_config = {"extra": "forbid"}

Validating JSON Payloads with Pydantic v2 and Returning Field-Level Errors in FastAPI

fastapi pydantic validation
by codesnips 3 tabs
go
package main

import (
  "context"
  "log"
  "net/http"

Graceful shutdown: draining HTTP + background workers

go http shutdown
by Leah Thompson 1 tab
go
package httpstream

import (
	"bufio"
	"database/sql"
	"fmt"

Streaming Large SQL Query Results as a JSON Array in Go

go database sql
by codesnips 2 tabs
python
import time
from dataclasses import dataclass
from typing import Optional

import requests

Bounded Concurrent HTTP Fan-Out With ThreadPoolExecutor and Retries

python concurrency threadpool
by codesnips 2 tabs
go
package main

import (
  "context"
  "net/http"
  "time"

HTTP server timeouts that prevent slowloris and stuck connections

go http reliability
by Leah Thompson 1 tab
ruby
class ParamSchema
  def initialize(fields)
    @fields = fields
  end

  def coerce(params)

Typed Query Param Coercion in a Sinatra before Filter with Schema Defaults

sinatra rack params
by codesnips 2 tabs
php
<?php

namespace App\Exports;

use Illuminate\Database\Eloquent\Builder;
use Illuminate\Support\Carbon;

Streaming a Filtered Orders CSV Export in Laravel with StreamedResponse

php laravel csv
by codesnips 3 tabs
typescript
const rawOrigins = process.env.ALLOWED_ORIGINS ?? "";

export const allowedOrigins = new Set(
  rawOrigins
    .split(",")
    .map((o) => o.trim())

CORS configuration that’s explicit (no *)

security http express
by codesnips 3 tabs
rust
use axum::{routing::get, Router, Json};
use serde::Serialize;

#[derive(Serialize)]
struct Response {
    message: String,

axum for type-safe async HTTP servers

rust async axum
by Marcus Chen 1 tab
go
package middleware

import (
  "net/http"

  "go.uber.org/zap"

Panic recovery middleware for HTTP servers

go http middleware
by Leah Thompson 1 tab