title: How to give HTTP API or REST API with Lambda, the ability to not update?
body: <p>So I have a Lambda Function with the code below, which is triggered by an API (AWS API Gateway).</p>
  <pre><code>import json
  
  def lambda_handler(event, context):
      testString = &quot;foo&quot;
      if &quot;f&quot; in testString:
          return {
              &quot;statusCode&quot;: 200,
              &quot;body&quot;: json.dumps(testString)
          }
  </code></pre>
  <p>I tested it with both a HTTP API and a REST API. Because the condition returns <code>True</code>, in both cases the output is <code>&quot;foo&quot;</code> as it should be. But what happens if <code>testString</code> suddenly changes to <code>&quot;goo&quot;</code>, and the condition returns <code>False</code>? I would like the output to remain as it previously was (not update), so it remains <code>&quot;foo&quot;</code>. But when this happens, the HTTP API outputs <code>null</code>, and the REST API outputs <code>{&quot;message&quot;: &quot;Internal server error&quot;}</code>.</p>
  <p>Maybe I just need to figure out the missing piece in the code below:</p>
  <pre><code>import json
  
  def lambda_handler(event, context):
      testString = &quot;goo&quot;
      if &quot;f&quot; in testString:
          return {
              &quot;statusCode&quot;: 200,
              &quot;body&quot;: json.dumps(testString)
          }
      else:
          #missing piece: make output not change
  </code></pre>
  <p>This is probably the first time, I have tried &quot;creating&quot; APIs tbh. What am I missing?</p>