Repository navigation
fix: strip trailing slashes from base_url across SDKs - #1803
Conversation
There was a problem hiding this comment.
Code Review
This pull request implements a robust normalization strategy for base URLs across multiple SDK languages (C#, Go, Kotlin, Swift, TypeScript, and Python) by stripping trailing slashes and surrounding quotes. This ensures consistent URL construction and prevents issues with double slashes in API requests. My review highlights potential nullability and case-sensitivity issues in the configuration parsing logic that should be addressed to improve reliability.
Go Tests 7 files 7 suites 3m 21s ⏱️ Results for commit cf60e01. ♻️ This comment has been updated with latest results. |
Codegen Tests0 tests 0 ✅ 0s ⏱️ Results for commit cf60e01. ♻️ This comment has been updated with latest results. |
Python Tests 11 files 11 suites 1m 37s ⏱️ Results for commit cf60e01. ♻️ This comment has been updated with latest results. |
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Summary
Fixes double-slash request URLs (e.g.
POST //api/4.0/loginreturning403 Forbidden) across all six language SDKs whenbase_url(orlooker_url) is configured with one or more trailing slashes:python/looker_sdk/rtl/api_settings.py,auth_session.py,api_methods.py):base_urlandlooker_urlinApiSettings(__init__and_clean_input), treating slash-only values as unconfigured./login,/login/{sudo_id},/logout,/auth, andapi_pathURLs.packages/sdk-rtl,packages/sdk-node,packages/sdk,packages/sdk-codegen,packages/sdk-codegen-scripts):stripTrailingSlashesin@looker/sdk-rtl(constants.ts) and apply it inApiSettings,ValueSettings,readEnvConfig,readIniConfig,APIMethods.makePath,functionalSdk,BaseTransport.makeUrl,TypescriptGen,Looker40SDK,Looker40SDKStream, andfetchSpec.kotlin/src/main/com/looker/sdk/ApiSettings.kt,rtl/Transport.kt,rtl/OAuthSession.kt):baseUrl/base_url/looker_urlinApiSettings,Transport, andOAuthSession.csharp/rtl/ApiSettings.cs,ApiMethods.cs,Transport.cs):ApiSettings.BaseUrl/ReadConfigand guard_apiPath,MakePath, andTransport.MakeUrl.swift/looker/rtl/constants.swift,apiSettings.swift,apiConfig.swift,baseTransport.swift,oauthSession.swift):stripTrailingSlashesand apply acrossValueSettings,ApiSettings,ApiConfig,BaseTransport.makeUrl, andOAuthSession.go/rtl/settings.go,auth.go):BaseUrlinNewSettingsFromFile,NewSettingsFromEnv,NewAuthSessionWithTransport, andAuthSession.Do.Testing
pytest tests/rtl/&black --checkyarn jest,yarn lint:ts(tsc), &eslint./gradlew test&./gradlew jardotnet test(RTL unit tests)swiftcRTL unit test verificationgo test -v ./rtl/...&go build ./...Developer Checklist ℹ️
Fixes #1714 🦕