code: def test_rdrh001_request_hooks(dash_duo):
      app = Dash(__name__)
  
      app.index_string = """<!DOCTYPE html>
      <html>
          <head>
              {%metas%}
              <title>{%title%}</title>
              {%favicon%}
              {%css%}
          </head>
          <body>
              <div id="top">Testing custom DashRenderer</div>
              {%app_entry%}
              <footer>
                  {%config%}
                  {%scripts%}
                  <script id="_dash-renderer" type"application/json">
                      const renderer = new DashRenderer({
                          request_pre: (payload) => {
                              var output = document.getElementById('output-pre')
                              var outputPayload = document.getElementById('output-pre-payload')
                              if(output) {
                                  output.innerHTML = 'request_pre changed this text!';
                              }
                              if(outputPayload) {
                                  outputPayload.innerHTML = JSON.stringify(payload);
                              }
                          },
                          request_post: (payload, response) => {
                              var output = document.getElementById('output-post')
                              var outputPayload = document.getElementById('output-post-payload')
                              var outputResponse = document.getElementById('output-post-response')
                              if(output) {
                                  output.innerHTML = 'request_post changed this text!';
                              }
                              if(outputPayload) {
                                  outputPayload.innerHTML = JSON.stringify(payload);
                              }
                              if(outputResponse) {
                                  outputResponse.innerHTML = JSON.stringify(response);
                              }
                          }
                      })
                  </script>
              </footer>
              <div id="bottom">With request hooks</div>
          </body>
      </html>"""
  
      app.layout = html.Div(
          [
              dcc.Input(id="input", value="initial value"),
              html.Div(
                  html.Div(
                      [
                          html.Div(id="output-1"),
                          html.Div(id="output-pre"),
                          html.Div(id="output-pre-payload"),
                          html.Div(id="output-post"),
                          html.Div(id="output-post-payload"),
                          html.Div(id="output-post-response"),
                      ]
                  )
              ),
          ]
      )
  
      @app.callback(
          Output("output-1", "children"), [Input("input", "value")]
      )
      def update_output(value):
          return value
  
      dash_duo.start_server(app)
  
      _in = dash_duo.find_element("#input")
      dash_duo.clear_input(_in)
  
      _in.send_keys("fire request hooks")
  
      dash_duo.wait_for_text_to_equal("#output-1", "fire request hooks")
      dash_duo.wait_for_text_to_equal(
          "#output-pre", "request_pre changed this text!"
      )
      dash_duo.wait_for_text_to_equal(
          "#output-post", "request_post changed this text!"
      )
  
      assert json.loads(
          dash_duo.find_element("#output-pre-payload").text
      ) == {
          "output": "output-1.children",
          "outputs": {"id": "output-1", "property": "children"},
          "changedPropIds": ["input.value"],
          "inputs": [
              {
                  "id": "input",
                  "property": "value",
                  "value": "fire request hooks",
              }
          ],
      }
  
      assert json.loads(
          dash_duo.find_element("#output-post-payload").text
      ) == {
          "output": "output-1.children",
          "outputs": {"id": "output-1", "property": "children"},
          "changedPropIds": ["input.value"],
          "inputs": [
              {
                  "id": "input",
                  "property": "value",
                  "value": "fire request hooks",
              }
          ],
      }
  
      assert json.loads(
          dash_duo.find_element("#output-post-response").text
      ) == {"output-1": {"children": "fire request hooks"}}
  
      assert (
          dash_duo.find_element("#top").text
          == "Testing custom DashRenderer"
      )
      assert (
          dash_duo.find_element("#bottom").text == "With request hooks"
      )
  
      assert dash_duo.get_logs() == []
  
file_path: dash/tests/integration/renderer/test_request_hooks.py
imports: import json
  import functools
  import flask
  import pytest
  from dash import Dash, Output, Input, html, dcc
  from dash.types import RendererHooks
  from werkzeug.exceptions import HTTPException
label_desc: Use image node_id 1 for calling a global function with example usage: test_rdrh001_request_hooks(dash_duo) and returns: value