fix: request html() from /search instead of the nonexistent /client endpoint - #13
Merged
Merged
Conversation
tanysheng
force-pushed
the
fix/html-endpoint
branch
from
September 23, 2026 02:02
0f3eb34 to
00e7840
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
SerpApi.html()sends its request to/client, which does not exist on serpapi.com. Every call gets the site's 404 HTML page back, and then fails with:Raw HTML is served from
/searchwithoutput=html. That is the same endpointsearch()(output=json) andmarkdown()(output=md) already use.No test covered
html(), so nothing caught it. It came up while reviewing #11, which documentsclient.html(parameter)under Features and Response Formats.Change
SerpApi.html()now callsget("/search", "html", parameter).HtmlApiTest, modeled onMarkdownApiTest. It stubs the HTTP client and checks the path and theoutput=htmlvalue. No network call orSERPAPI_KEYis needed.Verification
/clientpath,HtmlApiTest.htmlRequestsHtmlOutputFromSearchEndpointfails (expected:</[search]> but was:</[client]>). With the fix it passes.HtmlApiTest,MarkdownApiTest,ErrorResponseTest,ParameterStringBuilderTest,TimeoutTest) all pass.invalid response format: <!DOCTYPE html>...(the 404 page)Invalid API key. Your API key should be here: ...(the request now reaches the Search API)