Skip to content
This repository has been archived by the owner on Jun 21, 2022. It is now read-only.

Added Support for different responses for different query parameter values in GET request #61

Closed
wants to merge 10 commits into from

Conversation

vikram2330
Copy link

Added annotations for more support
QueryParams - supports query string params for GET request
for eg.
@Barricade(endpoint = "/jokes/random", queryParams = { @QueryParams( params = {@Params(name = "path",value = "success")} , response = @Response(fileName = "success.json",isDefault = true)), @QueryParams( params = {@Params(name = "path",value = "failure")} , response = @Response(fileName = "failure.json", statusCode = 401)) })

UrlPath - supports dynamic url endpoints for retrofit requests
for eg.
@Barricade(endpoint = "/jokes/", path = {@UrlPath(path = "path", responses = { @Response(fileName = "success.json") }) })

Also now we can enable or disable ShakeListener.

@mustafa01ali
Copy link
Contributor

This can't be merged until #62 is resolved.

@mustafa01ali
Copy link
Contributor

@vikram2330 found a few bugs -

  1. App is not compiling due to missing enableShakeToStart() in BarricadeApplication.java

  2. After removing the missing method, the app crashes when you enable Barricade and click Get Joke

2019-07-07 11:30:58.408 5512-5544/com.mutualmobile.barricade.sample E/AndroidAssetFileManager: barricade//jokes/random/success.json
2019-07-07 11:30:58.409 5512-5544/com.mutualmobile.barricade.sample E/AndroidRuntime: FATAL EXCEPTION: OkHttp Dispatcher
    Process: com.mutualmobile.barricade.sample, PID: 5512
    java.lang.NullPointerException: Attempt to invoke virtual method 'int java.io.InputStream.read()' on a null object reference
        at com.mutualmobile.barricade.utils.AndroidAssetFileManager.getContentsOfFileAsString(AndroidAssetFileManager.java:28)
        at com.mutualmobile.barricade.Barricade.getResponseFromFile(Barricade.java:170)
        at com.mutualmobile.barricade.Barricade.getResponse(Barricade.java:130)
        at com.mutualmobile.barricade.BarricadeInterceptor.intercept(BarricadeInterceptor.java:27)
        at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147)
        at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:121)
        at okhttp3.RealCall.getResponseWithInterceptorChain(RealCall.java:200)
        at okhttp3.RealCall$AsyncCall.execute(RealCall.java:147)
        at okhttp3.internal.NamedRunnable.run(NamedRunnable.java:32)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1162)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:636)
        at java.lang.Thread.run(Thread.java:764)

@vikram2330 vikram2330 closed this Aug 20, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants