-
Notifications
You must be signed in to change notification settings - Fork 405
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
Removed additional '?' in WFS request #2048
Conversation
web/client/epics/wfsquery.js
Outdated
@@ -122,8 +123,10 @@ const getWFSFilterData = (filterObj) => { | |||
|
|||
const getWFSFeature = (searchUrl, filterObj) => { | |||
const data = getWFSFilterData(filterObj); | |||
const urlParsedObj = Url.parse(searchUrl); | |||
const parsedUrl = urlParsedObj.protocol + '//' + urlParsedObj.host + urlParsedObj.pathname; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You should mix the query string parameters (service, outputFormat) with the ones coming from the original URL. So you can keep additional parameters in the URL.
web/client/epics/wfsquery.js
Outdated
return Rx.Observable.defer( () => | ||
axios.post(searchUrl + '?service=WFS&outputFormat=json', data, { | ||
axios.post(parsedUrl + params, data, { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How is this fixing the original issue of duplicate requests?
web/client/epics/wfsquery.js
Outdated
const {TOGGLE_CONTROL, setControlProperty} = require('../actions/controls'); | ||
const querystring = require('querystring'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what's this? I think is missing in package.json
web/client/epics/wfsquery.js
Outdated
let params = isObject(urlParsedObj.query) ? urlParsedObj.query : {}; | ||
params.service = 'WFS'; | ||
params.outputFormat = 'json'; | ||
const paramsString = querystring.stringify(params); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You don't need other libraries. You can do all with Url.format.
Create a new object from urlParsedObj modifying the query object and call Url.format with the new object.
Added an url parser on query to remove additional '?'