Skip to content

Commit 7f29069

Browse files
authored
Made tweaks to the middleware documentation (#474)
1 parent 3a483d5 commit 7f29069

File tree

1 file changed

+40
-40
lines changed

1 file changed

+40
-40
lines changed

language/en.yml

Lines changed: 40 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -344,68 +344,68 @@ middlewares:
344344
post: "Postprocessing and validation step"
345345
encoding:
346346
title: "JSON and form encode"
347-
description: "This middleware encodes request bodies automatically and sets the appropriate header."
348-
pre: "Here the encoding property on the route gets processed."
349-
post: "This is a noop, so no functionality."
347+
description: "This middleware automatically encodes request bodies (JSON or form data) and sets the correct Content-Type header. It is a quick prep step before sending HTTP requests."
348+
pre: "Here it checks if the reequest.autohandle field is set to either 'JSON' or 'form'. If JSON, the Content-Type is set to application/json, else if set to form then Content-Type is set to application/x-www-form-urlencoded. If autohandle is missing, it sends the request unmodified."
349+
post: "This is a no-op(no operation), so no functionality."
350350
access:
351-
title: "access token handling"
351+
title: "Access Token handling"
352352
description: "This handles bearer tokens, including JWTs retrieval and setting in common response structured."
353353
pre: "Adds an access token if it's available as Bearer Token."
354-
post: "Tries to retrieve an access token from a JSON response. It has multiple fallbacks to cover common naming schemes."
354+
post: "Tries to retrieve an access token from a JSON response. It has multiple fallbacks to cover common naming schemes like 'access', 'access-token' & 'access_token', 'refresh', 'refresh-token' & 'refresh_token'."
355355
csrf:
356-
title: "csrf-header handling"
356+
title: "CSRF-header Handling"
357357
description: "This middleware handles cross site request forgery tokens build in common manners."
358-
pre: "This will add a CSRF header if any data for it has been retrieved."
358+
pre: "This will automatically add a CSRF header if any data for it has been retrieved."
359359
post: "This will try to retrieve a new CSRF token from the response. It may not catch all, since implementations vary widely."
360360
2xx:
361-
title: "status 2xx check"
362-
description: "This is a validator for the HTTP status code."
363-
pre: "This is a noop, so no functionality."
364-
post: "This will fail if the status code of the response is less than 200 or bigger than 299."
361+
title: "Status Code 2xx Check"
362+
description: "This middleware validates that HTTP responses have status codes in the 200-299 range (successful responses). It acts as a quality gate to ensure your application only processes successful API responses."
363+
pre: "This is a no-op(no operation), so no functionality."
364+
post: "This will fail if the status code of the response is undefined, less than 200 or higher than 299."
365365
403:
366-
title: "status 403 check"
367-
description: "This is a validator for the HTTP status code."
368-
pre: "This is a noop, so no functionality."
369-
post: "This will fail if the status code of the response is different from 403."
366+
title: "Status Code 403 Check"
367+
description: "This is a specialized middleware to verify status code 403 responses."
368+
pre: "This is a no-op(no operation), so no functionality."
369+
post: "This will verify that a response status is exactly 403 (Forbidden) and throws a descriptive error if the response is missing a status code or if the status code isn't 403."
370370
404:
371-
title: "status 404 check"
372-
description: "This is a validator for the HTTP status code."
373-
pre: "This is a noop, so no functionality."
374-
post: "This will fail if the status code of the response is different from 404."
371+
title: "Status Code 404 Check"
372+
description: "This is a specialized middleware to verify status code 404 responses."
373+
pre: "This is a no-op(no operation), so no functionality."
374+
post: "This will verify that a response status is exactly 404 (Not Found) and throws a descriptive error if the response is missing a status code or if the status code isn't 404."
375375
user-agent:
376-
title: "user-agent"
376+
title: "User-Agent"
377377
description: "This sets a sensible user agent string, so it can easily be filtered out for logging."
378-
pre: "The user agent string will be added, based on the used versions of the project and the framework."
379-
post: "This is a noop, so no functionality."
378+
pre: "The user agent string will be added, based on the used versions of the project and the framework. It doesn't overwrite existing User-Agent headers."
379+
post: "This is a no-op(no operation), so no functionality."
380380
cookies:
381-
title: "cookies"
381+
title: "Cookies"
382382
description: "This middleware handles cookies sent via headers."
383-
pre: "This function sets all available cookies on the request."
384-
post: "This function retrieves all available cookies from the response."
383+
pre: "This adds all stored cookies to the request, it preserves existing request cookies (no overwrites)."
384+
post: "This function retrieves all available cookies from successful responses, updates cookie store with new values."
385385
json:
386-
title: "json-validator"
387-
description: "This validator checks for valid header and body content."
388-
pre: "This is a noop, so no functionality."
389-
post: "This will fail if no json was returned."
386+
title: "JSON-validator"
387+
description: "This validator checks for valid JSON in header and body response."
388+
pre: "This is a no-op(no operation), so no functionality."
389+
post: "This will confirm if the Content-Type header exists, validates if header matches application/json (case-insensitive), fails if no json was returned."
390390
xml:
391-
title: "xml-validator"
392-
description: "This validator checks for valid header and body content."
393-
pre: "This is a noop, so no functionality."
394-
post: "This will fail if no xml was returned."
391+
title: "XML-validator"
392+
description: "This validator checks for valid XML in header and body content."
393+
pre: "This is a no-op(no operation), so no functionality."
394+
post: "This will confirm existence of Content-Type header, validates header contains /xml (case-insensitive) supports variants like 'application/xml', 'text/xml' & 'application/atom+xml'. Fails if no xml was returned."
395395
silent-server-validator:
396396
title: "silent-server-validator"
397-
description: "This middleware tries to help keep servers a bit safer."
398-
pre: "This is a noop, so no functionality."
399-
post: "If the server discloses information about itself or the language used server-side, this will fail."
397+
description: "This middleware tries to detect leaks and help keep servers a bit safer."
398+
pre: "This is a no-op(no operation), so no functionality."
399+
post: "This checks if the server discloses information about itself (e.g Apache, nginx, IIS etc.) or the language used server-side (e.g PHP, Express, ASP.NET etc.), if it does then this will fail."
400400
success-check:
401-
title: "check response for success"
401+
title: "Check Response for Success"
402402
description: "This assumes a json response with a boolean or string status following common standards."
403-
pre: "This is a noop, so no functionality."
403+
pre: "This is a no-op(no operation), so no functionality."
404404
post: "If the success field is not there or not a know positive this will fail."
405405
failure-check:
406-
title: "check response for failure"
406+
title: "Check Response for Failure"
407407
description: "This assumes a json response with a boolean or string status following common standards."
408-
pre: "This is a noop, so no functionality."
408+
pre: "This is a no-op(no operation), so no functionality."
409409
post: "If the success field is not there or not a know negative this will fail."
410410
custom:
411411
title: "Custom Middleware"

0 commit comments

Comments
 (0)