def _describe_response_for_remediation(self, request: "_RequestSpec", actual_response: Json) -> str: method = request.method params = request.params result = actual_response.get("result") powered_by = actual_response.get("powered_by") request_snippet = f"""\ .request(""" if request.comment is not None: request_snippet += f""" comment={request.comment!r},""" request_snippet += f""" method={method!r}, params={params!r}, result={result!r},""" if not request.wait: request_snippet += f""" wait=False,""" if request.powered_by is not None: request_snippet += f""" powered_by={powered_by!r},""" request_snippet += f""" )""" remediation = f"""\ 1) If this was unexpected, then the language server is buggy and should be fixed. 2) If this was expected, you can update your request with the following code to make it match: {request_snippet} """ return remediation
def _describe_response_for_remediation( self, variables: VariableMap, request: "_RequestSpec", # pyre-fixme[11]: Annotation `Json` is not defined as a type. actual_response: Json, ) -> str: method = request.method params = request.params result = uninterpolate_variables(payload=actual_response.get("result"), variables=variables) powered_by = actual_response.get("powered_by") request_snippet = f"""\ .request( line=line(),""" if request.comment is not None: request_snippet += f""" comment={request.comment!r},""" request_snippet += f""" method={method!r}, params={params!r}, result={result!r},""" if request.wait_id is not None: request_snippet += f""" wait_id={request.wait_id!r},""" if powered_by is not None: request_snippet += f""" powered_by={powered_by!r},""" request_snippet += f""" )""" remediation = f"""\ 1) If this was unexpected, then the language server is buggy and should be fixed. 2) If this was expected, you can update your request with the following code to make it match: {request_snippet} """ return remediation