Skip to main content
Using Deno in production at your company? Earn free Deno merch.
Give us feedback
Module

x/sinco/tests/deps.ts>Drash.Request#bodyParam

Browser Automation and Testing Tool for Deno, written in full TypeScript
Latest
method Drash.Request.prototype.bodyParam
import { Drash } from "https://deno.land/x/sinco@v4.1.0/tests/deps.ts";
const { Request } = Drash;

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.