File tree Expand file tree Collapse file tree 2 files changed +29
-0
lines changed Expand file tree Collapse file tree 2 files changed +29
-0
lines changed Original file line number Diff line number Diff line change 3232 ]
3333 ]
3434 },
35+ "browser" : {
36+ "./src/services/correios.js" : " ./src/services/correios-browser-mock.js"
37+ },
3538 "repository" : {
3639 "type" : " git" ,
3740 "url" : " https://github.com/filipedeschamps/cep-promise.git"
Original file line number Diff line number Diff line change 1+ 'use strict'
2+
3+ import ServiceError from '../errors/service.js'
4+
5+ /*
6+ * This is a mock service to be used when Browserify
7+ * renders the distribution file. Correios service
8+ * doesn't support CORS, so there's no reason to
9+ * include the original file with it's (heavy)
10+ * dependencies like "xml2js"
11+ */
12+
13+ function fetchCorreiosService ( cepWithLeftPad ) {
14+
15+ return new Promise ( ( resolve , reject ) => {
16+ const serviceError = new ServiceError ( {
17+ message : 'O serviço dos Correios não aceita requests via Browser (CORS).' ,
18+ service : 'correios'
19+ } )
20+
21+ reject ( serviceError )
22+ } )
23+ }
24+
25+
26+ export default fetchCorreiosService
You can’t perform that action at this time.
0 commit comments