feat: add baseURL option for dynamic http question#1541
Draft
zacharyjhankin wants to merge 30 commits into
Draft
feat: add baseURL option for dynamic http question#1541zacharyjhankin wants to merge 30 commits into
zacharyjhankin wants to merge 30 commits into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This adds an option to dynamically set the baseURL of the dynamic question to the domain that is currently deployed.
Motivation and Context
We are using a graphQL endpoint to obtain the list of countries that the users can select as their country. This will always use the domain that the UOC is deployed on, and different environments will have different domains. This lets the code dynamically call its own domain. We also don't want users getting confused.
How Has This Been Tested
I made a dynamic http question in the develop branch and checked that in the proposal it would work to make the countries. using:
http://localhost:3000/graphql?query=query%20ExampleQuery%20%7B%20countries%20%7B%20value%20%7D%20%7D
$.data.countries[*].value
content-type:application/json
then I switched to my branch and ran npm run generate:sdk
I confirmed my conversion worked to add baseURL to the dynamic question.
I confirmed that the existing question would still work without changing anything in a new proposal
I then edited my proposal template HTTP question to use my baseURL setting.
I confirmed that the country list would still be shown in the proposal.
NOTE:
There is an existing bug that means the URL that the proposal uses when someone is filling it out to get the countries is the parent question. Not the question that is edited for the specific template. This means you may encounter this error when testing. So make sure to edit both the parent question and the template question when testing this to see it actually being used.
Tests included/Docs Updated?
Added backend unit test