Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

encodeUriSegment in resource encodes params, should be optional #1388

Open
@fredrikbonander

Description

@fredrikbonander

When having a $resource and sending a param to be used in the url, it would be nice if there was an option not to encode it. OOB it encodes (in this case the "path") param before it's match agains the url. For example

// In SomeResourceName factory:$resouce('/:path',{path: 'default.json'}, ...)// Useing SomeResourceNameSomeResourceName.get({path: 'game/mygame.json'})

This will result in a call to url "/game%2Fmygame.json" instead of "/game/mygame.json".

There's a quick-fix-workaround:

// In angular-resource.js and method encodeUriSegmentfunctionencodeUriSegment(val){returnencodeUriQuery(val,true).replace(/%26/gi,'&').replace(/%3D/gi,'=').replace(/%2B/gi,'+').replace(/%2F/gi,'/');// <--- Add this line}

I have no idea what will break, but as of know it works for me. One could also hijack the actions argument in ResourceFactory and pass a skip encode flag to the Route constructor's defaults argument to tell it to skip the encoding.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      close