Skip to main content
Module

x/drash/src/http/request.ts>DrashRequest#bodyParam

A microframework for Deno's HTTP server with zero third-party dependencies
Go to Latest
method DrashRequest.prototype.bodyParam
import { DrashRequest } from "https://deno.land/x/drash@v2.7.0/src/http/request.ts";

Get a body parameter of the request by the name

Examples

Example 1

// Assume you've sent a fetch request with:
//   {
//     user: {
//       name: "Drash"
//     }
//   }
const user = request.bodyParam<{ name: string }>("user") // { name: "Drash" }
// More examples:
request.bodyParam<BodyFile[]>('uploads')

Parameters

name: string

The body parameter name

Returns

T | undefined

The value of the parameter if found, or undefined if not found.