nuxt / http

Universal HTTP Module for Nuxt.js
https://http.nuxtjs.org
MIT License
229 stars 51 forks source link

feat: `$http.getBaseURL` #165

Closed sundowndev closed 3 years ago

sundowndev commented 3 years ago

following #164

This PR aims to create a getter for the internal prefixUrl property. This can be useful for computed properties in Vue templates. The _defaults property is not really resolving the issue since it has no type signature. This patch suggests a dedicated getter should be added.

codecov-io commented 3 years ago

Codecov Report

Merging #165 (4fbed8c) into master (a6f2195) will not change coverage. The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #165   +/-   ##
=======================================
  Coverage   97.01%   97.01%           
=======================================
  Files           1        1           
  Lines          67       67           
  Branches       39       39           
=======================================
  Hits           65       65           
  Misses          2        2           

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update a6f2195...4fbed8c. Read the comment docs.

atinux commented 3 years ago

Hi @sundowndev

I think you can add another line for baseURL using $http.getBaseURL(): here:https://github.com/nuxt/http/blob/master/test/fixture/pages/instance.vue#L3 And a test case line here: https://github.com/nuxt/http/blob/master/test/module.test.js#L82

pi0 commented 3 years ago

Hi @sundowndev. Thanks for PR <3 Would you please also update helpers section to mention this method? (https://http.nuxtjs.org/helpers)

sundowndev commented 3 years ago

Hi @sundowndev. Thanks for PR <3 Would you please also update helpers section to mention this method? (https://http.nuxtjs.org/helpers)

Done! Is that what you expected?