Function update_schema

Source
pub fn update_schema(a: &mut Value, b: &Value)
Expand description

Merge schema and update some keys

This is a thin wrapper around merge_schema that additionally:

  1. Copies the value of the header key requested-with-ajax (all lower-case) into the variants Requested-With-Ajax (Pascal-Case) and REQUESTED-WITH-AJAX (upper-case), or vice-versa, depending on which variant is present in the incoming schema.
  2. Overwrites the top-level version field with the compile-time constant VERSION.

The three header variants are created so that downstream code can read the header regardless of the casing rules enforced by the environment (HTTP servers, proxies, etc.).

§Arguments

  • a – the target Value (must be an Object) that will receive the merge result.
  • b – the source Value (must be an Object) whose contents are merged into a.