Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

setGlobalDomain 参数重复 #46

Open
hanouba opened this issue Jul 21, 2021 · 2 comments
Open

setGlobalDomain 参数重复 #46

hanouba opened this issue Jul 21, 2021 · 2 comments

Comments

@hanouba
Copy link

hanouba commented Jul 21, 2021

setGlobalDomain http://192.168.12.5:8055/CityInterface/
getGlobalDomain http://192.168.12.5:8055/CityInterface/

经过 HttpUrl newUrl = mUrlParser.parseUrl(httpUrl, request.url()); 处理后 多了个CityInterface

httpurl http://192.168.12.5:8055/CityInterface/
newurl http://192.168.12.5:8055/CityInterface/CityInterface/

@JessYanCoding
Copy link
Owner

https://github.com/JessYanCoding/RetrofitUrlManager/blob/master/manager/src/main/java/me/jessyan/retrofiturlmanager/parser/DefaultUrlParser.java#L52

断点这里看看,用的哪个解析器,然后看看解析器为什么加了这个 /CityInterface

@ILoveYouCC
Copy link

再初始化的时候加上这句开启高级模式。
RetrofitUrlManager.getInstance().startAdvancedModel(ApiService.SERVER_URL)

  • 本框架分为三种模式, 普通模式 (默认)、高级模式 (需要手动开启)、超级模式 (需要手动开启)
  • 普通模式:
  • 普通模式只能替换域名, 比如使用 "https:www.google.com" 作为 Retrofit 的 BaseUrl 可以被替换
  • 但是以 "https:www.google.com/api" 作为 BaseUrl 还是只能替换其中的域名 "https:www.google.com"
  • 详细替换规则可以查看 {@link DomainUrlParser}
  • 高级模式:
  • 高级模式只能替换 {@link #startAdvancedModel(String)} 中传入的 BaseUrl, 但可以替换拥有多个 pathSegments 的 BaseUrl
  • 如 "https:www.google.com/api", 需要手动开启高级模式 {@link #startAdvancedModel(String)}
  • 详细替换规则可以查看 {@link AdvancedUrlParser}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants